add some initialization and some assertion.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15554 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-10-26 08:10:22 +00:00
parent 1e3d50b669
commit e0c193fa92

View File

@ -123,7 +123,7 @@ T * getInsetByCode(LCursor & cur, InsetBase::Code code)
BufferView::BufferView() BufferView::BufferView()
: buffer_(0), wh_(0), : buffer_(0), wh_(0), width_(0), height_(0),
cursor_(*this), cursor_(*this),
multiparsel_cache_(false), anchor_ref_(0), offset_ref_(0), multiparsel_cache_(false), anchor_ref_(0), offset_ref_(0),
intl_(new Intl) intl_(new Intl)
@ -431,11 +431,14 @@ void BufferView::updateScrollbar()
sumh += h2; sumh += h2;
nh++; nh++;
} }
BOOST_ASSERT(nh);
int const hav = sumh / nh; int const hav = sumh / nh;
// More realistic average paragraph height // More realistic average paragraph height
if (hav > wh_) if (hav > wh_)
wh_ = hav; wh_ = hav;
BOOST_ASSERT(h);
scrollbarParameters_.height = (parsize + 1) * wh_; scrollbarParameters_.height = (parsize + 1) * wh_;
scrollbarParameters_.position = anchor_ref_ * wh_ + int(offset_ref_ * wh_ / float(h)); scrollbarParameters_.position = anchor_ref_ * wh_ + int(offset_ref_ * wh_ / float(h));
scrollbarParameters_.lineScrollHeight = int(wh_ * defaultRowHeight() / float(h)); scrollbarParameters_.lineScrollHeight = int(wh_ * defaultRowHeight() / float(h));