diff --git a/src/BufferView.h b/src/BufferView.h index 89602cbba1..df17dc0e1b 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -130,12 +130,6 @@ public: /// bool gotoLabel(string const & label); /// - void paste(); - /// - void cut(bool realcut = true); - /// - void copy(); - /// void pasteEnvironment(); /// void copyEnvironment(); diff --git a/src/BufferView2.C b/src/BufferView2.C index 1b6a774fd3..c467f4922f 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -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()) { diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 40c4069c47..ed0516ace3 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -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; diff --git a/src/ChangeLog b/src/ChangeLog index 3c2f0d7ddc..0d6883f369 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 * LyXAction.C: fix margin note description diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index ec16ae8de6..b75e938559 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -395,21 +395,10 @@ 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) { diff --git a/src/text3.C b/src/text3.C index 6671c3c5aa..e59ac3bd0a 100644 --- a/src/text3.C +++ b/src/text3.C @@ -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;