]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/formulabase.C
more trivial tweaks to mathed bindings
[lyx.git] / src / mathed / formulabase.C
index f31a291568198f30eb4f778f52e7eae6d06f505d..c6ee02b92debbe8db20a7e66c3cd3f77a32b35ca 100644 (file)
@@ -216,6 +216,7 @@ void InsetFormulaBase::getCursorPos(BufferView *, int & x, int & y) const
                return;
        }
        mathcursor->getPos(x, y);
+       x = mathcursor->targetX();
        x -= xo_;
        y -= yo_;
        //lyxerr << "getCursorPos: " << x << " " << y << "\n";
@@ -238,9 +239,9 @@ void InsetFormulaBase::showInsetCursor(BufferView * bv, bool)
                return;
        fitInsetCursor(bv);
        int x, y, asc, des;
-       getCursorPos(bv, x, y);
+       mathcursor->getPos(x, y);
        math_font_max_dim(font_, asc, des);
-       bv->showLockedInsetCursor(x + xo_, y, asc, des);
+       bv->showLockedInsetCursor(x, y - yo_, asc, des);
        setCursorVisible(true);
        //lyxerr << "showInsetCursor: " << x << " " << y << "\n";
 }
@@ -390,6 +391,9 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
                        return lfunMouseMotion(cmd);
                case LFUN_MOUSE_RELEASE:
                        return lfunMouseRelease(cmd);
+               case LFUN_MOUSE_DOUBLE:
+                       //lyxerr << "Mouse double\n";
+                       return localDispatch(FuncRequest(LFUN_WORDSEL));
                default:
                        break;
        }
@@ -422,12 +426,12 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
        case LFUN_MATH_EXTERN:
        case LFUN_TABULAR_FEATURE:
        case LFUN_PASTESELECTION:
+       case LFUN_MATH_LIMITS:
                bv->lockedInsetStoreUndo(Undo::EDIT);
                mathcursor->dispatch(cmd);
                updateLocal(bv, true);
                break;
 
-       case LFUN_WORDRIGHTSEL:
        case LFUN_RIGHTSEL:
                sel = true; // fall through...
        case LFUN_RIGHT:
@@ -439,7 +443,6 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
                //bv->owner()->message(mathcursor->info());
                break;
 
-       case LFUN_WORDLEFTSEL:
        case LFUN_LEFTSEL:
                sel = true; // fall through
        case LFUN_LEFT:
@@ -461,28 +464,42 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
                updateLocal(bv, false);
                break;
 
+       case LFUN_WORDSEL:
+               mathcursor->home(false);
+               mathcursor->end(true);
+               updateLocal(bv, false);
+               break;
+
        case LFUN_HOMESEL:
+       case LFUN_WORDLEFTSEL:
                sel = true; // fall through
        case LFUN_HOME:
+       case LFUN_WORDLEFT:
                result = mathcursor->home(sel) ? DISPATCHED : FINISHED;
                updateLocal(bv, false);
                break;
 
        case LFUN_ENDSEL:
+       case LFUN_WORDRIGHTSEL:
                sel = true; // fall through
        case LFUN_END:
+       case LFUN_WORDRIGHT:
                result = mathcursor->end(sel) ? DISPATCHED : FINISHED_RIGHT;
                updateLocal(bv, false);
                break;
 
        case LFUN_PRIORSEL:
        case LFUN_PRIOR:
+       case LFUN_BEGINNINGBUFSEL:
+       case LFUN_BEGINNINGBUF:
                result = FINISHED_UP;
                updateLocal(bv, false);
                break;
 
        case LFUN_NEXTSEL:
        case LFUN_NEXT:
+       case LFUN_ENDBUFSEL:
+       case LFUN_ENDBUF:
                result = FINISHED_DOWN;
                updateLocal(bv, false);
                break;
@@ -583,8 +600,8 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
        case LFUN_FRAK:         handleFont(bv, cmd.argument, "mathfrak"); break;
        case LFUN_ITAL:         handleFont(bv, cmd.argument, "mathit"); break;
        case LFUN_NOUN:         handleFont(bv, cmd.argument, "mathbb"); break;
-       case LFUN_DEFAULT:      handleFont(bv, cmd.argument, "textnormal"); break;
        case LFUN_FREE:         handleFont(bv, cmd.argument, "textrm"); break;
+       case LFUN_DEFAULT:      handleFont(bv, cmd.argument, "textnormal"); break;
 
        case LFUN_GREEK:
                handleFont(bv, cmd.argument, "lyxgreek1");
@@ -602,12 +619,6 @@ Inset::RESULT InsetFormulaBase::localDispatch(FuncRequest const & cmd)
                //bv->owner()->message(_("math text mode toggled"));
                break;
 
-       case LFUN_MATH_LIMITS:
-               bv->lockedInsetStoreUndo(Undo::EDIT);
-               if (mathcursor->toggleLimits())
-                       updateLocal(bv, true);
-               break;
-
        case LFUN_MATH_SIZE:
 #if 0
                if (!arg.empty()) {