]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
* Call metrics of the parameters with the correct font in MathMacros, for example
[lyx.git] / src / BufferView.cpp
index fc3163b7848302efbc0570d59d24af90050362c9..cea5b723c6d890a1c0e60e68bc9f1ec7bd906b31 100644 (file)
@@ -873,7 +873,6 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
        case LFUN_SCREEN_RECENTER:
        case LFUN_BIBTEX_DATABASE_ADD:
        case LFUN_BIBTEX_DATABASE_DEL:
-       case LFUN_GRAPHICS_GROUPS_UNIFY:
        case LFUN_NOTES_MUTATE:
        case LFUN_ALL_INSETS_TOGGLE:
        case LFUN_STATISTICS:
@@ -1189,6 +1188,10 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                FuncRequest req = cmd;
                if (cmd.argument().empty() && !d->search_request_cache_.argument().empty())
                        req = d->search_request_cache_;
+               if (req.argument().empty()) {
+                       theLyXFunc().dispatch(FuncRequest(LFUN_DIALOG_SHOW, "findreplace"));
+                       break;
+               }
                if (find(this, req))
                        showCursor();
                else
@@ -1221,7 +1224,7 @@ bool BufferView::dispatch(FuncRequest const & cmd)
 
        case LFUN_MARK_ON:
                cur.clearSelection();
-               cur.mark() = true;
+               cur.setMark(true);
                cur.resetAnchor();
                cur.message(from_utf8(N_("Mark on")));
                break;
@@ -1229,10 +1232,10 @@ bool BufferView::dispatch(FuncRequest const & cmd)
        case LFUN_MARK_TOGGLE:
                cur.clearSelection();
                if (cur.mark()) {
-                       cur.mark() = false;
+                       cur.setMark(false);
                        cur.message(from_utf8(N_("Mark removed")));
                } else {
-                       cur.mark() = true;
+                       cur.setMark(true);
                        cur.message(from_utf8(N_("Mark set")));
                }
                cur.resetAnchor();
@@ -1427,20 +1430,11 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                processUpdateFlags(Update::Force);
                break;
 
-       // These two could be rewriten using some command like forall <insetname> <command>
+       // This could be rewriten using some command like forall <insetname> <command>
        // once the insets refactoring is done.
-       case LFUN_GRAPHICS_GROUPS_UNIFY: {
-               if (cmd.argument().empty())
-                       break;
-               graphics::unifyGraphicsGroups(cur.buffer(), to_utf8(cmd.argument()));
-               processUpdateFlags(Update::Force | Update::FitCursor);
-               break;
-       }
-
        case LFUN_NOTES_MUTATE: {
                if (cmd.argument().empty())
                        break;
-               cur.recordUndoFullDocument();
 
                if (mutateNotes(cur, cmd.getArg(0), cmd.getArg(1))) {
                        processUpdateFlags(Update::Force);
@@ -1571,7 +1565,7 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
        Cursor old = cursor();
        Cursor cur(*this);
        cur.push(buffer_.inset());
-       cur.selection() = d->cursor_.selection();
+       cur.setSelection(d->cursor_.selection());
 
        // Either the inset under the cursor or the
        // surrounding Text will handle this event.
@@ -1618,6 +1612,8 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
        // Put anchor at the same position.
        cur.resetAnchor();
 
+       cur.beginUndoGroup();
+
        // Try to dispatch to an non-editable inset near this position
        // via the temp cursor. If the inset wishes to change the real
        // cursor it has to do so explicitly by using
@@ -1630,6 +1626,8 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
        if (!inset || !cur.result().dispatched())
                cur.dispatch(cmd);
 
+       cur.endUndoGroup();
+
        // Notify left insets
        if (cur != old) {
                old.fixIfBroken();
@@ -1750,9 +1748,8 @@ bool BufferView::setCursorFromInset(Inset const * inset)
        // Inset is not at cursor position. Find it in the document.
        Cursor cur(*this);
        cur.reset(buffer().inset());
-       do 
+       while (cur && cur.nextInset() != inset)
                cur.forwardInset();
-       while (cur && cur.nextInset() != inset);
 
        if (cur) {
                setCursor(cur);
@@ -1813,7 +1810,7 @@ void BufferView::setCursor(DocIterator const & dit)
                dit[i].inset().edit(d->cursor_, true);
 
        d->cursor_.setCursor(dit);
-       d->cursor_.selection() = false;
+       d->cursor_.setSelection(false);
 }