]> git.lyx.org Git - features.git/commitdiff
Add an update parameter to BufferView::scrollToCursor and BufferView::scrollDocView...
authorVincent van Ravesteijn <vfr@lyx.org>
Mon, 14 Jun 2010 21:48:23 +0000 (21:48 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Mon, 14 Jun 2010 21:48:23 +0000 (21:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34658 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp
src/BufferView.h
src/frontends/qt4/GuiWorkArea.cpp
src/insets/InsetTabular.cpp

index 74152382887da3693edc317eaa5aea7515e5ffdb..5a00d72de3adb1e49f51084c375f37f1d611c425 100644 (file)
@@ -568,7 +568,7 @@ docstring BufferView::contextMenu(int x, int y) const
 }
 
 
-void BufferView::scrollDocView(int value)
+void BufferView::scrollDocView(int value, bool update)
 {
        int const offset = value - d->scrollbarParameters_.position;
 
@@ -587,7 +587,7 @@ void BufferView::scrollDocView(int value)
        // cut off at the top
        if (value <= d->scrollbarParameters_.min) {
                DocIterator dit = doc_iterator_begin(&buffer_);
-               showCursor(dit, false);
+               showCursor(dit, false, update);
                LYXERR(Debug::SCROLLING, "scroll to top");
                return;
        }
@@ -596,7 +596,7 @@ void BufferView::scrollDocView(int value)
        if (value >= d->scrollbarParameters_.max) {
                DocIterator dit = doc_iterator_end(&buffer_);
                dit.backwardPos();
-               showCursor(dit, false);
+               showCursor(dit, false, update);
                LYXERR(Debug::SCROLLING, "scroll to bottom");
                return;
        }
@@ -614,14 +614,14 @@ void BufferView::scrollDocView(int value)
                // It seems we didn't find the correct pit so stay on the safe side and
                // scroll to bottom.
                LYXERR0("scrolling position not found!");
-               scrollDocView(d->scrollbarParameters_.max);
+               scrollDocView(d->scrollbarParameters_.max, update);
                return;
        }
 
        DocIterator dit = doc_iterator_begin(&buffer_);
        dit.pit() = i;
        LYXERR(Debug::SCROLLING, "value = " << value << " -> scroll to pit " << i);
-       showCursor(dit, false);
+       showCursor(dit, false, update);
 }
 
 
@@ -806,19 +806,20 @@ int BufferView::workWidth() const
 
 void BufferView::recenter()
 {
-       showCursor(d->cursor_, true);
+       showCursor(d->cursor_, true, true);
 }
 
 
 void BufferView::showCursor()
 {
-       showCursor(d->cursor_, false);
+       showCursor(d->cursor_, false, true);
 }
 
 
-void BufferView::showCursor(DocIterator const & dit, bool recenter)
+void BufferView::showCursor(DocIterator const & dit,
+       bool recenter, bool update)
 {
-       if (scrollToCursor(dit, recenter)) {
+       if (scrollToCursor(dit, recenter) && update) {
                buffer_.changed(true);
                updateHoveredInset();
        }
index 8d48301007bb1800159512a82277bac279bc1957..1880a583692158c7408593b70559b57cb8471e50 100644 (file)
@@ -159,7 +159,8 @@ public:
        /// This method will automatically scroll and update the BufferView
        /// if needed.
        /// \param recenter Whether the cursor should be centered on screen
-       void showCursor(DocIterator const & dit, bool recenter);
+       void showCursor(DocIterator const & dit, bool recenter,
+               bool update);
        /// Scroll to the cursor.
        void scrollToCursor();
        /// Scroll to the cursor.
@@ -174,7 +175,7 @@ public:
        /// scroll document by the given number of pixels.
        int scroll(int pixels);
        /// Scroll the view by a number of pixels.
-       void scrollDocView(int pixels);
+       void scrollDocView(int pixels, bool update);
        /// Set the cursor position based on the scrollbar one.
        void setCursorFromScrollbar();
 
index 368fa774b115b98129a594c6e20e743a7b9aa22d..d67ee9ad0c912bbc56d3118dfd14189a1efea16c 100644 (file)
@@ -618,7 +618,7 @@ void GuiWorkArea::updateScrollbar()
 void GuiWorkArea::scrollTo(int value)
 {
        stopBlinkingCursor();
-       buffer_view_->scrollDocView(value);
+       buffer_view_->scrollDocView(value, true);
 
        if (lyxrc.cursor_follows_scrollbar) {
                buffer_view_->setCursorFromScrollbar();
index 7639d54a873a2fa7956b3ee531123b402da726b2..475362fcc6b6e5ae54b017966c461cd99073c450 100644 (file)
@@ -3931,7 +3931,7 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
 //             col_type const col = tabular.cellColumn(cur.idx());
 //             int const t =   cur.bv().top_y() + cur.bv().height();
 //             if (t < yo() + tabular.getHeightOfTabular()) {
-//                     cur.bv().scrollDocView(t);
+//                     cur.bv().scrollDocView(t, true);
 //                     cur.idx() = tabular.cellBelow(first_visible_cell) + col;
 //             } else {
 //                     cur.idx() = tabular.getFirstCellInRow(tabular.rows() - 1) + col;
@@ -3947,7 +3947,7 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
 //             col_type const col = tabular.cellColumn(cur.idx());
 //             int const t =   cur.bv().top_y() + cur.bv().height();
 //             if (yo() < 0) {
-//                     cur.bv().scrollDocView(t);
+//                     cur.bv().scrollDocView(t, true);
 //                     if (yo() > 0)
 //                             cur.idx() = col;
 //                     else