#include "math_data.h"
#include "math_mathmlstream.h"
#include "math_streamstr.h"
+#include "BufferView.h"
#include "dispatchresult.h"
#include "debug.h"
#include "funcrequest.h"
#include "LColor.h"
+
#include "frontends/Painter.h"
+
#include "support/std_sstream.h"
#include "insets/mailinset.h"
}
-bool MathGridInset::idxUpDown(BufferView & bv, bool up, int targetx) const
+bool MathGridInset::idxUpDown(LCursor & cur, bool up, int targetx) const
{
- CursorSlice & cur = cursorTip(bv);
if (up) {
if (cur.idx() < ncols())
return false;
}
-bool MathGridInset::idxLeft(BufferView & bv) const
+bool MathGridInset::idxLeft(LCursor & cur) const
{
// leave matrix if on the left hand edge
- CursorSlice & cur = cursorTip(bv);
if (cur.col() == 0)
return false;
--cur.idx();
}
-bool MathGridInset::idxRight(BufferView & bv) const
+bool MathGridInset::idxRight(LCursor & cur) const
{
// leave matrix if on the right hand edge
- CursorSlice & cur = cursorTip(bv);
if (cur.col() + 1 == ncols())
return false;
++cur.idx();
}
-bool MathGridInset::idxFirst(BufferView & bv) const
+bool MathGridInset::idxFirst(LCursor & cur) const
{
- CursorSlice & cur = cursorTip(bv);
switch (v_align_) {
case 't':
cur.idx() = 0;
}
-bool MathGridInset::idxLast(BufferView & bv) const
+bool MathGridInset::idxLast(LCursor & cur) const
{
- CursorSlice & cur = cursorTip(bv);
switch (v_align_) {
case 't':
cur.idx() = ncols() - 1;
}
-bool MathGridInset::idxHome(BufferView & bv) const
+bool MathGridInset::idxHome(LCursor & cur) const
{
- CursorSlice & cur = cursorTip(bv);
if (cur.pos() > 0) {
cur.pos() = 0;
return true;
}
-bool MathGridInset::idxEnd(BufferView & bv) const
+bool MathGridInset::idxEnd(LCursor & cur) const
{
- CursorSlice & cur = cursorTip(bv);
if (cur.pos() < cur.lastpos()) {
cur.pos() = cur.lastpos();
return true;
}
-void MathGridInset::splitCell(BufferView & bv)
+void MathGridInset::splitCell(LCursor & cur)
{
- CursorSlice & cur = cursorTip(bv);
if (cur.idx() + 1 == nargs())
return;
MathArray ar = cur.cell();
DispatchResult
MathGridInset::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
{
- CursorSlice & cur = cursorTip(bv);
+ LCursor & cur = bv.fullCursor();
switch (cmd.action) {
case LFUN_MOUSE_RELEASE:
case LFUN_CELL_SPLIT:
//recordUndo(bv, Undo::ATOMIC);
- splitCell(bv);
+ splitCell(cur);
return DispatchResult(true, FINISHED);
case LFUN_BREAKLINE: {
std::swap(cell(index(r, c)), cell(index(r + 1, c)));
// split cell
- splitCell(bv);
+ splitCell(cur);
std::swap(cell(cur.idx()), cell(cur.idx() + ncols() - 1));
if (cur.idx() > 0)
--cur.idx();