#endif
#include "math_scriptinset.h"
-#include "debug.h"
#include "math_support.h"
+#include "math_symbolinset.h"
#include "math_mathmlstream.h"
#include "support/LAssert.h"
+#include "debug.h"
MathScriptInset::MathScriptInset()
}
-bool MathScriptInset::covers(int x, int y) const
-{
- for (idx_type i = 0; i < 2; ++i)
- if (has(i) && xcell(i).covers(x, y))
- return true;
- return false;
-}
-
-
int MathScriptInset::dy0(MathInset const * nuc) const
{
int nd = ndes(nuc);
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;
}
}
-bool MathScriptInset::idxFirstUp(idx_type & idx, pos_type & pos) const
-{
- if (!hasUp())
- return false;
- idx = 1;
- pos = 0;
- return true;
-}
-
-
-bool MathScriptInset::idxFirstDown(idx_type & idx, pos_type & pos) const
-{
- if (!hasDown())
- return false;
- idx = 0;
- pos = 0;
- return true;
-}
-
-
-bool MathScriptInset::idxLastUp(idx_type & idx, pos_type & pos) const
-{
- if (!hasUp())
- return false;
- idx = 1;
- pos = up().data_.size();
- return true;
-}
-
-
-bool MathScriptInset::idxLastDown(idx_type & idx, pos_type & pos) const
-{
- if (!hasDown())
- return false;
- idx = 0;
- pos = down().data_.size();
- return true;
-}
-
-
void MathScriptInset::write(WriteStream & os) const
{
//lyxerr << "unexpected call to MathScriptInset::write()\n";
os << "\\limits ";
}
} else
- if (os.firstitem)
+ if (os.firstitem())
lyxerr << "suppressing {} \n";
else
os << "{}";