}
-
-auto_ptr<InsetBase> MathScriptInset::clone() const
+auto_ptr<InsetBase> MathScriptInset::doClone() const
{
return auto_ptr<InsetBase>(new MathScriptInset(*this));
}
else {
nuc().setXY(x + dxx(), y);
if (editing(pi.base.bv))
- drawStr(pi, pi.base.font, x + dxx(), y, ".");
+ pi.draw(x + dxx(), y, ".");
}
ScriptChanger dummy(pi.base);
if (hasUp())
void MathScriptInset::removeScript(bool up)
{
- lyxerr << "MathNestInset::removeScript: 1 up: " << up << endl;
+ lyxerr << "MathScriptInset::removeScript: 1 up: " << up << endl;
if (nargs() == 2) {
- lyxerr << "MathNestInset::removeScript: a up: " << up << endl;
+ lyxerr << "MathScriptInset::removeScript: a up: " << up << endl;
if (up == cell_1_is_up_)
cells_.pop_back();
- lyxerr << "MathNestInset::removeScript: b up: " << up << endl;
+ lyxerr << "MathScriptInset::removeScript: b up: " << up << endl;
} else if (nargs() == 3) {
if (up == true) {
swap(cells_[1], cells_[2]);
}
cells_.pop_back();
}
- lyxerr << "MathNestInset::removeScript: 2 up: " << up << endl;
+ lyxerr << "MathScriptInset::removeScript: 2 up: " << up << endl;
}
{
MathNestInset::notifyCursorLeaves(cur);
+ //lyxerr << "MathScriptInset::notifyCursorLeaves: 1 " << cur << endl;
+
// remove empty scripts if possible
- if (nargs() > 2 && cur.idx() == 2 && cell(2).empty()) {
- // must be a subscript...
- removeScript(false);
- // sanitize cursor, even if this slice will be removed immediately
- cur.idx() = 0;
- cur.pos() = 0;
+ if (nargs() > 2) {
+ // Case of two scripts. In this case, 1 = super, 2 = sub
+ if (cur.idx() == 2 && cell(2).empty()) {
+ // must be a subscript...
+ removeScript(false);
+ } else if (cur.idx() == 1 && cell(1).empty()) {
+ // must be a superscript...
+ removeScript(true);
+ }
} else if (nargs() > 1 && cur.idx() == 1 && cell(1).empty()) {
// could be either subscript or super script
removeScript(cell_1_is_up_);
- // sanitize cursor, even if this slice will be removed immediately
- cur.idx() = 0;
- cur.pos() = 0;
}
+
+ //lyxerr << "MathScriptInset::notifyCursorLeaves: 2 " << cur << endl;
}
-void MathScriptInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
+void MathScriptInset::doDispatch(LCursor & cur, FuncRequest & cmd)
{
//lyxerr << "MathScriptInset: request: " << cmd << std::endl;
return;
}
- MathNestInset::priv_dispatch(cur, cmd);
+ MathNestInset::doDispatch(cur, cmd);
}