}
-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);
int MathScriptInset::dx0(MathInset const * nuc) const
{
lyx::Assert(hasDown());
- return hasLimits(nuc) ? (width(nuc) - down().width()) / 2 : nwid(nuc);
+ return hasLimits(nuc) ? (width2(nuc) - down().width()) / 2 : nwid(nuc);
}
int MathScriptInset::dx1(MathInset const * nuc) const
{
lyx::Assert(hasUp());
- return hasLimits(nuc) ? (width(nuc) - up().width()) / 2 : nwid(nuc);
+ return hasLimits(nuc) ? (width2(nuc) - up().width()) / 2 : nwid(nuc);
}
int MathScriptInset::dxx(MathInset const * nuc) const
{
//lyx::Assert(nuc());
- return hasLimits(nuc) ? (width(nuc) - nwid(nuc)) / 2 : 0;
+ return hasLimits(nuc) ? (width2(nuc) - nwid(nuc)) / 2 : 0;
}
-int MathScriptInset::ascent(MathInset const * nuc) const
+int MathScriptInset::ascent2(MathInset const * nuc) const
{
return dy1(nuc) + (hasUp() ? up().ascent() : 0);
}
-int MathScriptInset::descent(MathInset const * nuc) const
+int MathScriptInset::descent2(MathInset const * nuc) const
{
return dy0(nuc) + (hasDown() ? down().descent() : 0);
}
-int MathScriptInset::width(MathInset const * nuc) const
+int MathScriptInset::width2(MathInset const * nuc) const
{
int wid = 0;
if (hasLimits(nuc)) {
void MathScriptInset::metrics(MathInset const * nuc,
MathMetricsInfo const & mi) const
{
- MathNestInset::metrics(mi);
+ mi_ = mi;
+ smallerStyleScript(mi_);
+ MathNestInset::metrics(mi_);
if (nuc)
nuc->metrics(mi);
-
- ascent_ = ascent(nuc);
- descent_ = descent(nuc);
- width_ = width(nuc);
+ ascent_ = ascent2(nuc);
+ descent_ = descent2(nuc);
+ width_ = width2(nuc);
}
{
if (nuc)
nuc->draw(pain, x + dxx(nuc), y);
- else
+ else if (editing())
drawStr(pain, LM_TC_TEX, mi_, x + dxx(nuc), y, ".");
if (hasUp())
}
+bool MathScriptInset::empty() const
+{
+ return !script_[0] && !script_[1];
+}
+
+
bool MathScriptInset::hasUp() const
{
return script_[1];
}
-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";