Hello,

This patch makes LyXText code use directly LyXText::dispatch() instead of the cur.bv().owner()->dispatch() redirection.

Objection?

Abdel.
Index: text2.C
===================================================================
--- text2.C     (revision 15030)
+++ text2.C     (working copy)
@@ -366,13 +366,13 @@
        if (lyxlayout->is_environment) {
                // move everything in a new environment inset
                lyxerr[Debug::DEBUG] << "setting layout " << layout << endl;
-               bv.owner()->dispatch(FuncRequest(LFUN_LINE_BEGIN));
-               bv.owner()->dispatch(FuncRequest(LFUN_LINE_END_SELECT));
-               bv.owner()->dispatch(FuncRequest(LFUN_CUT));
+               dispatch(cur, FuncRequest(LFUN_LINE_BEGIN));
+               dispatch(cur, FuncRequest(LFUN_LINE_END_SELECT));
+               dispatch(cur, FuncRequest(LFUN_CUT));
                InsetBase * inset = new InsetEnvironment(params, layout);
                insertInset(cur, inset);
                //inset->edit(cur, true);
-               //bv.owner()->dispatch(FuncRequest(LFUN_PASTE));
+               //dispatch(cur, FuncRequest(LFUN_PASTE));
                return;
        }
 
Index: text3.C
===================================================================
--- text3.C     (revision 15030)
+++ text3.C     (working copy)
@@ -266,7 +266,7 @@
        recordUndo(cur);
        bool gotsel = false;
        if (cur.selection()) {
-               cur.bv().owner()->dispatch(FuncRequest(LFUN_CUT));
+               text->dispatch(cur, FuncRequest(LFUN_CUT));
                gotsel = true;
        }
        text->insertInset(cur, inset);
@@ -275,7 +275,7 @@
                inset->edit(cur, true);
 
        if (gotsel && pastesel) {
-               cur.bv().owner()->dispatch(FuncRequest(LFUN_PASTE));
+               text->dispatch(cur, FuncRequest(LFUN_PASTE));
                // reset first par to default
                if (cur.lastpit() != 0 || cur.lastpos() != 0) {
                        LyXLayout_ptr const layout =
@@ -936,16 +936,16 @@
                        cur.posRight();
                }
                else
-                       bv->owner()->dispatch(FuncRequest(LFUN_SELF_INSERT, 
"\""));
+                       dispatch(cur, FuncRequest(LFUN_SELF_INSERT, "\""));
                break;
        }
 
        case LFUN_DATE_INSERT:
                if (cmd.argument().empty())
-                       bv->owner()->dispatch(FuncRequest(LFUN_SELF_INSERT,
+                       dispatch(cur, FuncRequest(LFUN_SELF_INSERT,
                                lyx::formatted_time(lyx::current_time())));
                else
-                       bv->owner()->dispatch(FuncRequest(LFUN_SELF_INSERT,
+                       dispatch(cur, FuncRequest(LFUN_SELF_INSERT,
                                lyx::formatted_time(lyx::current_time(), 
lyx::to_utf8(cmd.argument()))));
                break;
 
@@ -980,7 +980,7 @@
                // we have to check this first
                bool paste_internally = false;
                if (cmd.button() == mouse_button::button2 && cur.selection()) {
-                       bv->owner()->dispatch(FuncRequest(LFUN_COPY));
+                       dispatch(cur, FuncRequest(LFUN_COPY));
                        paste_internally = true;
                }
 
@@ -991,9 +991,9 @@
                // insert this
                if (cmd.button() == mouse_button::button2) {
                        if (paste_internally)
-                               bv->owner()->dispatch(FuncRequest(LFUN_PASTE));
+                               dispatch(cur, FuncRequest(LFUN_PASTE));
                        else
-                               
bv->owner()->dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph"));
+                               dispatch(cur, 
FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph"));
                }
 
                break;

Reply via email to