]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
EmbeddedObjects.lyx: add hint how to force a rotation direction for rotated floats
[lyx.git] / src / Text3.cpp
index 85187f50fa41292367c5135de12523968bcacf95..63e523a898046346dcb076bf93e289f127190dea 100644 (file)
@@ -120,7 +120,6 @@ namespace {
                if (selecting || cur.mark())
                        cur.setSelection();
                saveSelection(cur);
-               cur.bv().switchKeyMap();
        }
 
 
@@ -489,8 +488,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                && cur.boundary() == oldBoundary) {
                        cur.undispatched();
                        cmd = FuncRequest(LFUN_FINISHED_RIGHT);
-               }
-               if (cur.selection())
+               } else if (cur.selection())
                        saveSelection(cur);
                break;
 
@@ -512,25 +510,29 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        saveSelection(cur);
                break;
 
+       case LFUN_UP_SELECT:
+       case LFUN_DOWN_SELECT:
        case LFUN_UP:
-       case LFUN_UP_SELECT: {
-               //lyxerr << "handle LFUN_UP[SEL]:\n" << cur << endl;
-               needsUpdate |= cur.selHandle(cmd.action == LFUN_UP_SELECT);
-               bool const successful = cur.upDownInText(true, needsUpdate);
-               if (!successful)
-                       cur.undispatched();
-               if (cur.selection())
-                       saveSelection(cur);
-               break;
-       }
-
-       case LFUN_DOWN:
-       case LFUN_DOWN_SELECT: {
-               //lyxerr << "handle LFUN_DOWN[SEL]:\n" << cur << endl;
-               needsUpdate |= cur.selHandle(cmd.action == LFUN_DOWN_SELECT);
-               bool const successful = cur.upDownInText(false, needsUpdate);
-               if (!successful)
+       case LFUN_DOWN: {
+               // stop/start the selection
+               bool select = cmd.action == LFUN_DOWN_SELECT ||
+                       cmd.action == LFUN_UP_SELECT;
+               cur.selHandle(select);
+               
+               // move cursor up/down
+               bool up = cmd.action == LFUN_UP_SELECT || cmd.action == LFUN_UP;
+               bool const successful = cur.upDownInText(up, needsUpdate);
+               if (successful) {
+                       // notify insets which were left and get their update flags 
+                       notifyCursorLeaves(cur.beforeDispatchCursor(), cur);
+                       cur.fixIfBroken();
+                       
+                       // redraw if you leave mathed (for the decorations)
+                       needsUpdate |= cur.beforeDispatchCursor().inMathed();
+               } else
                        cur.undispatched();
+               
+               // save new selection
                if (cur.selection())
                        saveSelection(cur);
                break;
@@ -680,7 +682,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        cutSelection(cur, true, false);
                        singleParUpdate = false;
                }
-               bv->switchKeyMap();
                break;
 
        case LFUN_DELETE_BACKWARD_SKIP:
@@ -701,14 +702,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                cap::replaceSelection(cur);
                breakParagraph(cur, 0);
                cur.resetAnchor();
-               bv->switchKeyMap();
                break;
 
        case LFUN_BREAK_PARAGRAPH_KEEP_LAYOUT:
                cap::replaceSelection(cur);
                breakParagraph(cur, 1);
                cur.resetAnchor();
-               bv->switchKeyMap();
                break;
 
        case LFUN_BREAK_PARAGRAPH_SKIP: {
@@ -720,7 +719,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                else
                        breakParagraph(cur, 0);
                cur.resetAnchor();
-               bv->switchKeyMap();
                break;
        }
 
@@ -863,7 +861,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                }
                bv->buffer()->errors("Paste");
                cur.clearSelection(); // bug 393
-               bv->switchKeyMap();
                finishUndo();
                break;
 
@@ -954,7 +951,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        setLayout(cur, layout);
                        // inform the GUI that the layout has changed.
                        bv->layoutChanged(layout);
-                       bv->switchKeyMap();
                }
                break;
        }
@@ -1076,7 +1072,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                cap::pasteSelection(cur, bv->buffer()->errorList("Paste"));
                                bv->buffer()->errors("Paste");
                                cur.clearSelection(); // bug 393
-                               bv->switchKeyMap();
                                bv->buffer()->markDirty();
                                finishUndo();
                        } else {
@@ -1157,7 +1152,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        cur.noUpdate();
                }
 
-               bv->switchKeyMap();
                break;
        }
 
@@ -1181,8 +1175,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                docstring::const_iterator cit = cmd.argument().begin();
                docstring::const_iterator end = cmd.argument().end();
                for (; cit != end; ++cit)
-                       bv->getIntl().getTransManager().
-                               translateAndInsert(*cit, this, cur);
+                       bv->translateAndInsert(*cit, this, cur);
 
                cur.resetAnchor();
                moveCursor(cur, false);
@@ -1375,7 +1368,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_MATH_DELIM:
        case LFUN_MATH_BIGDELIM: {
                cur.insert(new InsetMathHull(hullSimple));
-               cur.dispatch(FuncRequest(LFUN_CHAR_FORWARD));
+               checkAndActivateInset(cur, true);
                BOOST_ASSERT(cur.inMathed());
                cur.dispatch(cmd);
                break;
@@ -1450,7 +1443,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                Font font(Font::ALL_IGNORE);
                font.setLanguage(lang);
                toggleAndShow(cur, this, font);
-               bv->switchKeyMap();
                break;
        }
 
@@ -1525,8 +1517,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                theLyXFunc().handleKeyFunc(cmd.action);
                if (!cmd.argument().empty())
                        // FIXME: Are all these characters encoded in one byte in utf8?
-                       bv->getIntl().getTransManager()
-                               .translateAndInsert(cmd.argument()[0], this, cur);
+                       bv->translateAndInsert(cmd.argument()[0], this, cur);
                break;
 
        case LFUN_FLOAT_LIST: {