bool const fit_cursor = fitCursor();
// tell the frontend to update the screen if needed.
if (fit_cursor) {
- updateMetrics(false);
+ updateMetrics();
buffer_.changed();
return;
}
if (flags & Update::MultiParSel)
full_metrics |= multiParSel();
- bool const single_par = !full_metrics;
- updateMetrics(single_par);
+ if (full_metrics || singleParUpdate())
+ // We have to update the full screen metrics.
+ updateMetrics();
if (!(flags & Update::FitCursor)) {
buffer_.changed();
// The screen has been recentered around the cursor position so
// refresh it:
- updateMetrics(false);
+ updateMetrics();
buffer_.changed();
}
tm.redoParagraph(d->anchor_ref_);
int const h = tm.parMetrics(d->anchor_ref_).height();
d->offset_ref_ = int((bar * t.paragraphs().size() - d->anchor_ref_) * h);
- updateMetrics(false);
+ updateMetrics();
buffer_.changed();
}
if (p.y_ < 0 || p.y_ > height_) {
// The cursor is off-screen so recenter before proceeding.
center();
- updateMetrics(false);
+ updateMetrics();
//FIXME: updateMetrics() does not update paragraph position
// This is done at draw() time. So we need a redraw!
buffer_.changed();
width_ = width;
height_ = height;
- updateMetrics(false);
+ updateMetrics();
}
tm.newParMetricsDown();
}
d->offset_ref_ += offset;
- updateMetrics(false);
+ updateMetrics();
buffer_.changed();
}
tm.newParMetricsUp();
}
d->offset_ref_ -= offset;
- updateMetrics(false);
+ updateMetrics();
buffer_.changed();
}
updateLabels(buffer_);
- updateMetrics(false);
+ updateMetrics();
buffer_.changed();
return true;
}
}
-void BufferView::updateMetrics(bool singlepar)
+void BufferView::updateMetrics()
{
- if (singlepar && singleParUpdate())
- // No need to update the full screen metrics.
- return;
-
Text & buftext = buffer_.text();
pit_type const npit = int(buftext.paragraphs().size());
// emit message signal.
message(bformat(res, disp_fn));
buffer_.errors("Parse");
- updateMetrics(false);
+ updateMetrics();
}
/// \sa ViewMetricsInfo
ViewMetricsInfo const & viewMetricsInfo();
/// update the internal \c ViewMetricsInfo.
- /// \param singlepar indicates wether
- void updateMetrics(bool singlepar = false);
+ void updateMetrics();
///
TextMetrics const & textMetrics(Text const * t) const;
// metrics are already up to date.
if (lyx_view_ != theApp()->currentView()) {
// FIXME: it would be nice to optimize for the off-screen case.
- buffer_view_->updateMetrics(false);
+ buffer_view_->updateMetrics();
buffer_view_->cursor().fixIfBroken();
}
return;
}
- bufferview()->updateMetrics(false);
+ bufferview()->updateMetrics();
bufferview()->buffer().changed();
}
GuiWorkArea * wa = new GuiWorkArea(buffer, *this);
wa->setUpdatesEnabled(false);
d.tab_widget_->addTab(wa, toqstr(buffer.fileName().displayName(30)));
- wa->bufferView().updateMetrics(false);
+ wa->bufferView().updateMetrics();
if (d.stack_widget_)
d.stack_widget_->setCurrentWidget(d.tab_widget_);
// Hide tabbar if there's only one tab.
void GuiWorkArea::showCursor(int x, int y, int h, CursorShape shape)
{
if (schedule_redraw_) {
- buffer_view_->updateMetrics(false);
+ buffer_view_->updateMetrics();
updateScreen();
viewport()->update(QRect(0, 0, viewport()->width(), viewport()->height()));
schedule_redraw_ = false;
}
GuiPainter pain(&screen_);
- buffer_view_->updateMetrics(false);
+ buffer_view_->updateMetrics();
buffer_view_->draw(pain);
FontInfo font = buffer_view_->cursor().getFont().fontInfo();
FontMetrics const & fm = theFontMetrics(font);
GuiWorkArea * wa = dynamic_cast<GuiWorkArea *>(widget(i));
BOOST_ASSERT(wa);
BufferView & bv = wa->bufferView();
- bv.updateMetrics(false);
+ bv.updateMetrics();
bv.cursor().fixIfBroken();
wa->setUpdatesEnabled(true);
wa->redraw();