}
-bool MathGridInset::idxUpDown(LCursor & cur, bool up, int targetx) const
+bool MathGridInset::idxUpDown(LCursor & cur, bool up) const
{
if (up) {
if (cur.idx() < ncols())
return false;
cur.idx() += ncols();
}
- cur.pos() = cur.cell().x2pos(targetx - cur.cell().xo());
+ cur.pos() = cur.cell().x2pos(cur.x_target() - cur.cell().xo());
return true;
}
// move cells if necessary
for (idx_type i = index(row(idx), 0); i < idx; ++i)
- std::swap(cell(i), cell(i + ncols()));
+ swap(cell(i), cell(i + ncols()));
delRow(row(idx));
DispatchResult
MathGridInset::priv_dispatch(LCursor & cur, FuncRequest const & cmd)
{
+ //lyxerr << "*** MathGridInset: request: " << cmd << endl;
switch (cmd.action) {
case LFUN_MOUSE_RELEASE:
// GridInsetMailer(*this).showDialog();
// return DispatchResult(true, true);
//}
- return DispatchResult(false);
+ return MathNestInset::priv_dispatch(cur, cmd);
case LFUN_INSET_DIALOG_UPDATE:
GridInsetMailer(*this).updateDialog(&cur.bv());
//}
if (nrows() > 1)
delRow(cur.row());
- if (cur.idx() >= nargs())
- cur.idx() = nargs() - 1;
+ if (cur.idx() > cur.lastidx())
+ cur.idx() = cur.lastidx();
if (cur.pos() > cur.lastpos())
cur.pos() = cur.lastpos();
return DispatchResult(true, FINISHED);
case LFUN_CELL_SPLIT:
- //recordUndo(cur, Undo::ATOMIC);
+ ////recordUndo(cur, Undo::ATOMIC);
splitCell(cur);
return DispatchResult(true, FINISHED);
case LFUN_BREAKLINE: {
- //recordUndo(cur, Undo::INSERT);
+ ////recordUndo(cur, Undo::INSERT);
row_type const r = cur.row();
addRow(r);
// split line
for (col_type c = col(cur.idx()) + 1; c < ncols(); ++c)
- std::swap(cell(index(r, c)), cell(index(r + 1, c)));
+ swap(cell(index(r, c)), cell(index(r + 1, c)));
// split cell
splitCell(cur);
- std::swap(cell(cur.idx()), cell(cur.idx() + ncols() - 1));
+ swap(cell(cur.idx()), cell(cur.idx() + ncols() - 1));
if (cur.idx() > 0)
--cur.idx();
cur.idx() = cur.lastpos();