]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathHull.cpp
simplify GuiToc / TocWidget interaction. Much can still be simplified...
[lyx.git] / src / mathed / InsetMathHull.cpp
index 3560d5a2eda6a21dcaca4b3e6b4f167429cfdcf5..976b4865cf2f28a88186fded7b75e0f03fa18697 100644 (file)
@@ -1027,6 +1027,8 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_FINISHED_BACKWARD:
        case LFUN_FINISHED_FORWARD:
+       case LFUN_FINISHED_RIGHT:
+       case LFUN_FINISHED_LEFT:
                //lyxerr << "action: " << cmd.action << endl;
                InsetMathGrid::doDispatch(cur, cmd);
                notifyCursorLeaves(cur);
@@ -1050,7 +1052,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
                InsetMathGrid::doDispatch(cur, cmd);
                break;
 
-       case LFUN_MATH_NUMBER: {
+       case LFUN_MATH_NUMBER_TOGGLE: {
                //lyxerr << "toggling all numbers" << endl;
                cur.recordUndoInset();
                bool old = numberedType();
@@ -1064,7 +1066,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
                break;
        }
 
-       case LFUN_MATH_NONUMBER: {
+       case LFUN_MATH_NUMBER_LINE_TOGGLE: {
                cur.recordUndoInset();
                row_type r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
                bool old = numbered(r);
@@ -1136,6 +1138,10 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
                }
                if (cur.pos() > cur.lastpos())
                        cur.pos() = cur.lastpos();
+               
+               // FIXME: find some more clever handling of the selection,
+               // i.e. preserve it.
+               cur.clearSelection();
                //cur.dispatched(FINISHED);
                break;
        }
@@ -1162,6 +1168,8 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
        switch (cmd.action) {
        case LFUN_FINISHED_BACKWARD:
        case LFUN_FINISHED_FORWARD:
+       case LFUN_FINISHED_RIGHT:
+       case LFUN_FINISHED_LEFT:
        case LFUN_UP:
        case LFUN_DOWN:
        case LFUN_NEW_LINE:
@@ -1171,13 +1179,13 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
                // we handle these
                status.enabled(true);
                return true;
-       case LFUN_MATH_NUMBER:
+       case LFUN_MATH_NUMBER_TOGGLE:
                // FIXME: what is the right test, this or the one of
                // LABEL_INSERT?
                status.enabled(display());
                status.setOnOff(numberedType());
                return true;
-       case LFUN_MATH_NONUMBER: {
+       case LFUN_MATH_NUMBER_LINE_TOGGLE: {
                // FIXME: what is the right test, this or the one of
                // LABEL_INSERT?
                status.enabled(display());
@@ -1306,10 +1314,12 @@ void InsetMathHull::handleFont2(Cursor & cur, docstring const & arg)
 }
 
 
-void InsetMathHull::edit(Cursor & cur, bool front)
+void InsetMathHull::edit(Cursor & cur, bool front, EntryDirection entry_from)
 {
        cur.push(*this);
-       front ? idxFirst(cur) : idxLast(cur);
+       bool enter_front = (entry_from == Inset::ENTRY_DIRECTION_LEFT || 
+               (entry_from == Inset::ENTRY_DIRECTION_IGNORE && front));
+       enter_front ? idxFirst(cur) : idxLast(cur);
        // The inset formula dimension is not necessarily the same as the
        // one of the instant preview image, so we have to indicate to the
        // BufferView that a metrics update is needed.