scrolling tweaks.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22231 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-21 13:03:45 +00:00
parent ccd6d709cb
commit f833ad1d2c

View File

@ -442,20 +442,31 @@ void BufferView::updateScrollbar()
for (pit_type pit = first.first; pit <= last.first; ++pit) { for (pit_type pit = first.first; pit <= last.first; ++pit) {
ParagraphMetrics const & pm = tm.parMetrics(pit); ParagraphMetrics const & pm = tm.parMetrics(pit);
d->par_height_[pit] = pm.height(); d->par_height_[pit] = pm.height();
if (first_visible_pit < 0 && pm.position() + pm.descent() > 0) if (first_visible_pit >= 0 || pm.position() + pm.descent() <= 0)
first_visible_pit = pit; continue;
first_visible_pit = pit;
LYXERR(Debug::SCROLLING, "first visible pit " << first_visible_pit);
// FIXME: we should look for the first visible row within
// the deepest inset!
int row_pos = pm.position();
size_t const nrows = pm.rows().size();
for (size_t i = 0; i != nrows; ++i) {
Row const & row = pm.rows()[i];
if (row_pos >= 0) {
LYXERR(Debug::SCROLLING, "first visible row " << i
<< "(row pos = )" << row_pos << ");");
break;
}
row_pos += row.height();
}
d->scrollbarParameters_.position = row_pos;
} }
LYXERR(Debug::SCROLLING, "first_visible_pit " << first_visible_pit);
d->scrollbarParameters_.height = 0; d->scrollbarParameters_.height = 0;
for (size_t i = 0; i != d->par_height_.size(); ++i) { for (size_t i = 0; i != d->par_height_.size(); ++i) {
if (i == first_visible_pit)
d->scrollbarParameters_.position += d->scrollbarParameters_.height;
d->scrollbarParameters_.height += d->par_height_[i]; d->scrollbarParameters_.height += d->par_height_[i];
if (i != first_visible_pit)
continue;
// FIXME: we should look for the first visible row within
// the deepest inset!
d->scrollbarParameters_.position = d->scrollbarParameters_.height;
} }
d->scrollbarParameters_.lineScrollHeight = d->scrollbarParameters_.lineScrollHeight =