]> git.lyx.org Git - features.git/commitdiff
move cut&paste lfun handling from BufferView to LyXText
authorAndré Pönitz <poenitz@gmx.net>
Mon, 26 Aug 2002 13:25:49 +0000 (13:25 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 26 Aug 2002 13:25:49 +0000 (13:25 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5112 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.h
src/BufferView2.C
src/BufferView_pimpl.C
src/ChangeLog
src/mathed/math_cursor.C
src/text3.C

index 89602cbba180b8b2e2eaea28f7f260341987cd34..df17dc0e1bcdf4d75e280e8ef5b608efc6a83cb8 100644 (file)
@@ -130,12 +130,6 @@ public:
        ///
        bool gotoLabel(string const & label);
        ///
-       void paste();
-       ///
-       void cut(bool realcut = true);
-       ///
-       void copy();
-       ///
        void pasteEnvironment();
        ///
        void copyEnvironment();
index 1b6a774fd32bbfe35a386b7da1824baf41c68238..c467f4922ff0060c13b1cf01a5a450235da02a25 100644 (file)
@@ -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 40c4069c47a8f13e10254ee72972bcb5a80d2b5a..ed0516ace3bf99408bd4941d85bee0310ee6d918 100644 (file)
@@ -1442,19 +1442,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
                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 3c2f0d7ddc7fa41bb7edbbc61a9fd23914397f0c..0d6883f3694b8e614751700cd4b101be6a273df1 100644 (file)
@@ -3,6 +3,11 @@
 
        * paragraph.[Ch]: Martin's patch for the \end_deeper bug
 
+       * BufferView.h:
+       * BufferView2.C:
+       * BufferView_pimpl.C:
+       * text3.C: mun hanfling of LFUN_CUT/COPY/PASTE to LyXText
+
 2002-08-25  John Levon  <levon@movementarian.org>
 
        * LyXAction.C: fix margin note description
index ec16ae8de6dac4cee2e3d2282a4cf7a929c14992..b75e938559739defbfd8e572f5fb3df9688706b6 100644 (file)
@@ -395,20 +395,9 @@ void MathCursor::insert(MathArray const & ar)
        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)
index 6671c3c5aaaa7ce9845f790b295c8800f932c78a..e59ac3bd0a981b52b6740d7822ba5a68ad60f713 100644 (file)
@@ -485,7 +485,9 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        // 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(FuncRequest const & cmd)
                                        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(FuncRequest const & cmd)
                                // 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(FuncRequest const & cmd)
                                         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:
@@ -769,6 +776,33 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                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:
                if (inset_owner)
                        return Inset::UNDISPATCHED;