This somewhat changes semantics as the original version "dispatches" to
the "main" LyXText, whereas this patch dispatches to the one returned by
getLyXText(). I have played a bit around and could not find any problem so
I would guess it is safe. But as I am not sure it would be nice if somebody
could have a look and/or give it a try.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)
Index: BufferView.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.h,v
retrieving revision 1.101
diff -u -p -r1.101 BufferView.h
--- BufferView.h        22 Aug 2002 13:02:13 -0000      1.101
+++ BufferView.h        26 Aug 2002 12:50:35 -0000
@@ -130,12 +130,6 @@ public:
        ///
        bool gotoLabel(string const & label);
        ///
-       void paste();
-       ///
-       void cut(bool realcut = true);
-       ///
-       void copy();
-       ///
        void pasteEnvironment();
        ///
        void copyEnvironment();
Index: BufferView2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView2.C,v
retrieving revision 1.146
diff -u -p -r1.146 BufferView2.C
--- BufferView2.C       20 Aug 2002 17:18:17 -0000      1.146
+++ BufferView2.C       26 Aug 2002 12:50:35 -0000
@@ -391,57 +391,7 @@ void BufferView::pasteEnvironment()
 }
 
 
-void BufferView::copy()
-{
-       if (available()) {
-               getLyXText()->copySelection(this);
-               owner()->message(_("Copy"));
-       }
-}
-
-
-void BufferView::cut(bool realcut)
-{
-       if (available()) {
-               hideCursor();
-               update(text, BufferView::SELECT|BufferView::FITCUR);
-               text->cutSelection(this, true, realcut);
-               update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-               owner()->message(_("Cut"));
-       }
-}
-
-
-void BufferView::paste()
-{
-       if (!available())
-               return;
-
-       owner()->message(_("Paste"));
-
-       hideCursor();
-       // clear the selection
-       toggleSelection();
-       text->clearSelection();
-       update(text, BufferView::SELECT|BufferView::FITCUR);
-
-       // paste
-       text->pasteSelection(this);
-       // bug 393
-       text->clearSelection();
-       update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-// why fake a selection only I think it should be a real one and not only
-// a painted one (Jug 20020318).
-#if 0
-       // clear the selection
-       toggleSelection();
-       text->clearSelection();
-       update(text, BufferView::SELECT|BufferView::FITCUR);
-#endif
-}
-
-
-/* these functions are for the spellchecker */
+// these functions are for the spellchecker
 WordLangTuple const BufferView::nextWord(float & value)
 {
        if (!available()) {
Index: BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.293
diff -u -p -r1.293 BufferView_pimpl.C
--- BufferView_pimpl.C  23 Aug 2002 09:05:27 -0000      1.293
+++ BufferView_pimpl.C  26 Aug 2002 12:50:35 -0000
@@ -1442,19 +1442,6 @@ bool BufferView::Pimpl::dispatch(FuncReq
                break;
        }
 
-       case LFUN_PASTE:
-               bv_->paste();
-               switchKeyMap();
-               break;
-
-       case LFUN_CUT:
-               bv_->cut();
-               break;
-
-       case LFUN_COPY:
-               bv_->copy();
-               break;
-
        case LFUN_LAYOUT_COPY:
                bv_->copyEnvironment();
                break;
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.6
diff -u -p -r1.6 text3.C
--- text3.C     22 Aug 2002 15:04:27 -0000      1.6
+++ text3.C     26 Aug 2002 12:50:35 -0000
@@ -485,7 +485,9 @@ Inset::RESULT LyXText::dispatch(FuncRequ
                        // just comment out the line below...
                        bv->showCursor();
                } else {
-                       bv->cut(false);
+                       update(bv, false);
+                       cutSelection(bv, true);
+                       update(bv);
                }
                bv->moveCursorUpdate(false);
                bv->owner()->view_state_changed();
@@ -518,15 +520,16 @@ Inset::RESULT LyXText::dispatch(FuncRequ
                                        cursorLeft(bv);
                                        Delete(bv);
                                        selection.cursor = cursor;
-                                       update(bv);
                                }
                        } else {
                                Delete(bv);
                                selection.cursor = cursor;
-                               update(bv);
                        }
-               } else
-                       bv->cut(false);
+               } else {
+                       update(bv, false);
+                       cutSelection(bv, true);
+               }
+               update(bv);
                break;
 
 
@@ -540,8 +543,11 @@ Inset::RESULT LyXText::dispatch(FuncRequ
                                // just comment out the line below...
                                bv->showCursor();
                        }
-               } else
-                       bv->cut(false);
+               } else {
+                       update(bv, false);
+                       cutSelection(bv, true);
+                       update(bv);
+               }
                bv->owner()->view_state_changed();
                bv->switchKeyMap();
                break;
@@ -562,14 +568,15 @@ Inset::RESULT LyXText::dispatch(FuncRequ
                                         cur.par()->params().spacing(),
                                         cur.par()->params().align(),
                                         cur.par()->params().labelWidthString(), 0);
-                               update(bv);
                        } else {
                                backspace(bv);
                                selection.cursor = cur;
-                               update(bv);
                        }
-               } else
-                       bv->cut(false);
+               } else {
+                       update(bv, false);
+                       cutSelection(bv, true);
+               }
+               update(bv);
                break;
 
        case LFUN_BREAKPARAGRAPH:
@@ -767,6 +774,33 @@ Inset::RESULT LyXText::dispatch(FuncRequ
                if (inset_owner)
                        bv->updateInset(inset_owner, true);
                update(bv);
+               break;
+
+       case LFUN_PASTE:
+               cmd.message(_("Paste"));
+               bv->hideCursor();
+               // clear the selection
+               bv->toggleSelection();
+               clearSelection();
+               update(bv, false);
+               pasteSelection(bv);
+               clearSelection(); // bug 393
+               update(bv, false);
+               update(bv);
+               bv->switchKeyMap();
+               break;
+
+       case LFUN_CUT:
+               bv->hideCursor();
+               update(bv, false);
+               cutSelection(bv, true);
+               update(bv);
+               cmd.message(_("Cut"));
+               break;
+
+       case LFUN_COPY:
+               copySelection(bv);
+               cmd.message(_("Copy"));
                break;
 
        case LFUN_BEGINNINGBUFSEL:
Index: mathed/math_cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.C,v
retrieving revision 1.314
diff -u -p -r1.314 math_cursor.C
--- mathed/math_cursor.C        26 Aug 2002 12:11:47 -0000      1.314
+++ mathed/math_cursor.C        26 Aug 2002 12:50:35 -0000
@@ -395,20 +395,9 @@ void MathCursor::insert(MathArray const 
        macroModeClose();
        if (selection_)
                eraseSelection();
-
        array().insert(pos(), ar);
        pos() += ar.size();
 }
-
-/*
-void MathCursor::paste(MathArray const & ar)
-{
-       Anchor_ = Cursor_;
-       selection_ = true;
-       array().insert(pos(), ar);
-       pos() += ar.size();
-}
-*/
 
 
 void MathCursor::paste(MathGridInset const & data)

Reply via email to