From 527cd00d2fdb184464e7f04ced6d10c59324722e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 27 Aug 2002 14:43:49 +0000 Subject: [PATCH] move 42, kill 12 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5120 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.C | 6 ------ src/BufferView.h | 2 -- src/BufferView_pimpl.C | 30 -------------------------- src/BufferView_pimpl.h | 2 -- src/text3.C | 49 +++++++++++++++++++++++++++++++++--------- 5 files changed, 39 insertions(+), 50 deletions(-) diff --git a/src/BufferView.C b/src/BufferView.C index 146699307e..871b81975f 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -230,9 +230,3 @@ bool BufferView::dispatch(FuncRequest const & ev) { return pimpl_->dispatch(ev); } - - -void BufferView::moveCursorUpdate(bool selecting, bool fitcur) -{ - pimpl_->moveCursorUpdate(selecting, fitcur); -} diff --git a/src/BufferView.h b/src/BufferView.h index 149ef1b641..7303ec2ad2 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -190,8 +190,6 @@ public: void stuffClipboard(string const &) const; /// bool dispatch(FuncRequest const & argument); - /// - void moveCursorUpdate(bool selecting, bool fitcur = true); private: /// struct Pimpl; diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 00c98f725d..6e1f60e2ef 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -1227,36 +1227,6 @@ void BufferView::Pimpl::stuffClipboard(string const & stuff) const */ -void BufferView::Pimpl::moveCursorUpdate(bool selecting, bool fitcur) -{ - LyXText * lt = bv_->getLyXText(); - - if (selecting || lt->selection.mark()) { - lt->setSelection(bv_); - if (lt->bv_owner) - toggleToggle(); - else - updateInset(lt->inset_owner, false); - } - if (lt->bv_owner) { - if (fitcur) - update(lt, BufferView::SELECT|BufferView::FITCUR); - else - update(lt, BufferView::SELECT); - showCursor(); - } else if (bv_->text->status() != LyXText::UNCHANGED) { - bv_->theLockingInset()->hideInsetCursor(bv_); - update(bv_->text, BufferView::SELECT|BufferView::FITCUR); - showCursor(); - } - - if (!lt->selection.set()) - workarea().haveSelection(false); - - switchKeyMap(); -} - - Inset * BufferView::Pimpl::getInsetByCode(Inset::Code code) { #if 0 diff --git a/src/BufferView_pimpl.h b/src/BufferView_pimpl.h index e7cc824406..868d4a55eb 100644 --- a/src/BufferView_pimpl.h +++ b/src/BufferView_pimpl.h @@ -173,8 +173,6 @@ private: }; /// std::vector saved_positions; - /// - void moveCursorUpdate(bool selecting, bool fitcur = true); /// Get next inset of this class from current cursor position Inset * getInsetByCode(Inset::Code code); /// diff --git a/src/text3.C b/src/text3.C index 007e0ab6e0..207bb5e0ca 100644 --- a/src/text3.C +++ b/src/text3.C @@ -42,10 +42,40 @@ extern string current_layout; namespace { - void finishChange(BufferView * bv, bool fitcur = false) + void moveCursorUpdate(BufferView * bv, bool selecting) + { + LyXText * lt = bv->getLyXText(); + + if (selecting || lt->selection.mark()) { + lt->setSelection(bv); + if (lt->bv_owner) + bv->toggleToggle(); + else + bv->updateInset(lt->inset_owner, false); + } + if (lt->bv_owner) { + //if (fitcur) + // bv->update(lt, BufferView::SELECT|BufferView::FITCUR); + //else + bv->update(lt, BufferView::SELECT); + bv->showCursor(); + } else if (bv->text->status() != LyXText::UNCHANGED) { + bv->theLockingInset()->hideInsetCursor(bv); + bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR); + bv->showCursor(); + } + + if (!lt->selection.set()) + bv->workarea().haveSelection(false); + + bv->switchKeyMap(); + } + + + void finishChange(BufferView * bv, bool selecting = false) { finishUndo(); - bv->moveCursorUpdate(fitcur); + moveCursorUpdate(bv, selecting); bv->owner()->view_state_changed(); } @@ -523,7 +553,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) finishChange(bv, false); // was: // finishUndo(); - // moveCursorUpdate(false, false); + // moveCursorUpdate(bv, false, false); // owner_->view_state_changed(); break; @@ -556,7 +586,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) insertChar(bv, Paragraph::META_NEWLINE); update(bv, true); setCursor(bv, cursor.par(), cursor.pos()); - bv->moveCursorUpdate(false); + moveCursorUpdate(bv, false); break; case LFUN_DELETE: @@ -572,7 +602,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) cutSelection(bv, true); update(bv); } - bv->moveCursorUpdate(false); + moveCursorUpdate(bv, false); bv->owner()->view_state_changed(); bv->switchKeyMap(); break; @@ -769,7 +799,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) } else { specialChar(this, bv, InsetSpecialChar::PROTECTED_SEPARATOR); } - bv->moveCursorUpdate(false); + moveCursorUpdate(bv, false); break; case LFUN_HYPHENATION: @@ -997,7 +1027,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) // this was originally a beforeChange(bv->text), i.e // the outermost LyXText! bv->beforeChange(this); - string const clip(bv->workarea().getClipboard()); + string const clip = bv->workarea().getClipboard(); if (!clip.empty()) { if (cmd.argument == "paragraph") insertStringAsParagraphs(bv, clip); @@ -1030,7 +1060,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) Paragraph const * par = cursor.par(); lyx::pos_type pos = cursor.pos(); char c; - if (!pos) c = ' '; else if (par->isInset(pos - 1) && par->getInset(pos - 1)->isSpace()) @@ -1067,7 +1096,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) update(bv, true); } selection.cursor = cursor; - bv->moveCursorUpdate(false); + moveCursorUpdate(bv, false); break; } @@ -1100,7 +1129,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd) update(bv); selection.cursor = cursor; - bv->moveCursorUpdate(false); + moveCursorUpdate(bv, false); // real_current_font.number can change so we need to // update the minibuffer -- 2.39.5