Log:
* BufferView/pimpl:
- scrollDocView(): call to BufferView::update() deleted.
- scrollDocView(): second part is now in setCursorFromScrollbar()
- setCursorFromScrollbar(): new method.
* WorkArea:
- setBufferView(): show the cursor immediately
- redraw(): call to updateScrollbar()
- updateScrollbar(): new method
- scrollBufferView(): fix it and show the cursor immediately.
* qt4/GuiWorkArea
- setScrollbarParams(): now disable the Qt scrollbar tracking.
- paintEvent(): scrollbar related code deleted
* qt3/QWorkArea
- setScrollbarParams(): now disable the Qt scrollbar tracking.
* qt3/QContentPane
- paintEvent(): scrollbar related code deleted
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14704
a592a061-630c-0410-9148-
cb99ea01b6c8
}
+void BufferView::setCursorFromScrollbar()
+{
+ pimpl_->setCursorFromScrollbar();
+}
+
+
bool BufferView::available() const
{
return pimpl_->available();
void scroll(int lines);
/// Scroll the view by a number of pixels
void scrollDocView(int pixels);
+ /// Set the cursor position based on the scrollbar one.
+ void setCursorFromScrollbar();
/// return the pixel width of the document view
int workWidth() const;
t.redoParagraph(anchor_ref_);
int const h = t.getPar(anchor_ref_).height();
offset_ref_ = int((bar * t.paragraphs().size() - anchor_ref_) * h);
- update();
+}
- if (!lyxrc.cursor_follows_scrollbar)
- return;
+
+void BufferView::Pimpl::setCursorFromScrollbar()
+{
+ LyXText & t = *bv_->text();
int const height = 2 * defaultRowHeight();
int const first = height;
ScrollbarParameters const & scrollbarParameters() const;
///
void scrollDocView(int value);
+ ///
+ void setCursorFromScrollbar();
/// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
void scroll(int lines);
///
void WorkArea::setBufferView(BufferView * buffer_view)
{
+ hideCursor();
buffer_view_ = buffer_view;
+ toggleCursor();
}
}
buffer_view_->updateMetrics(false);
+
+ updateScrollbar();
+
ViewMetricsInfo const & vi = buffer_view_->viewMetricsInfo();
greyed_out_ = false;
getPainter().start();
}
+void WorkArea::updateScrollbar()
+{
+ buffer_view_->updateScrollbar();
+ ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters();
+ setScrollbarParams(scroll_.height, scroll_.position,
+ scroll_.lineScrollHeight);
+}
+
+
void WorkArea::scrollBufferView(int position)
{
buffer_view_->scrollDocView(position);
- lyx_view_.updateLayoutChoice();
redraw();
+ hideCursor();
+ if (lyxrc.cursor_follows_scrollbar) {
+ buffer_view_->setCursorFromScrollbar();
+ lyx_view_.updateLayoutChoice();
+ }
+ toggleCursor();
}
LyXView & lyx_view_;
private:
+ ///
+ void updateScrollbar();
///
void checkAndGreyOut();
QPainter q(this);
q.drawPixmap(QPoint(r.x(), r.y()),
*pixmap_.get(), r);
-
- buffer_view_->updateScrollbar();
- ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters();
-
- wa_->scrollbar_->setTracking(false);
- wa_->setScrollbarParams(scroll_.height, scroll_.position,
- scroll_.lineScrollHeight);
- wa_->scrollbar_->setTracking(true);
}
void QWorkArea::setScrollbarParams(int h, int pos, int line_h)
{
+ scrollbar_->setTracking(false);
// do what cursor movement does (some grey)
h += height() / 4;
content_->trackScrollbar(true);
scrollbar_->setLineStep(line_h);
scrollbar_->setPageStep(height());
+
+ scrollbar_->setTracking(true);
}
} // namespace frontend
void GuiWorkArea::setScrollbarParams(int h, int scroll_pos, int scroll_line_step)
{
+ verticalScrollBar()->setTracking(false);
+
// do what cursor movement does (some grey)
h += height() / 4;
int scroll_max_ = std::max(0, h - height());
verticalScrollBar()->setRange(0, scroll_max_);
verticalScrollBar()->setSliderPosition(scroll_pos);
verticalScrollBar()->setSingleStep(scroll_line_step);
+
+ verticalScrollBar()->setTracking(true);
}
if (show_hcursor_)
q.drawPixmap(cursor_x_, cursor_y_ + cursor_h_ - 1, hcursor_);
-
- buffer_view_->updateScrollbar();
-
- ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters();
-
- verticalScrollBar()->setTracking(false);
- setScrollbarParams(scroll_.height, scroll_.position,
- scroll_.lineScrollHeight);
- verticalScrollBar()->setTracking(true);
}