}
+ViewMetricsInfo const & BufferView::Pimpl::viewMetricsInfo()
+{
+ return metrics_info_;
+}
+
+
void BufferView::Pimpl::update(Update::flags flags)
{
- lyxerr[Debug::DEBUG]
- << BOOST_CURRENT_FUNCTION
- << "[fitcursor = " << (flags & Update::FitCursor)
- << ", forceupdate = " << (flags & Update::Force)
- << ", singlepar = " << (flags & Update::SinglePar)
- << "] buffer: " << buffer_ << endl;
+ // This is close to a hot-path.
+ if (lyxerr.debugging(Debug::DEBUG)) {
+ lyxerr[Debug::DEBUG]
+ << BOOST_CURRENT_FUNCTION
+ << "[fitcursor = " << (flags & Update::FitCursor)
+ << ", forceupdate = " << (flags & Update::Force)
+ << ", singlepar = " << (flags & Update::SinglePar)
+ << "] buffer: " << buffer_ << endl;
+ }
// Check needed to survive LyX startup
if (buffer_) {
// Update macro store
buffer_->buildMacros();
- CoordCache backup;
- std::swap(theCoords, backup);
-
// This, together with doneUpdating(), verifies (using
// asserts) that screen redraw is not called from
// within itself.
theCoords.startUpdating();
// First drawing step
- ViewMetricsInfo vi = metrics(flags & Update::SinglePar);
+ bool singlePar = flags & Update::SinglePar;
bool forceupdate(flags & (Update::Force | Update::SinglePar));
- if ((flags & Update::FitCursor) && fitCursor()) {
+ if ((flags & (Update::FitCursor | Update::MultiParSel))
+ && (fitCursor() || multiParSel())) {
forceupdate = true;
- vi = metrics();
- }
- if ((flags & Update::MultiParSel) && multiParSel()) {
- forceupdate = true;
- vi = metrics();
+ singlePar = false;
}
+
if (forceupdate) {
// Second drawing step
- owner_->workArea()->redraw(*bv_, vi);
+ updateMetrics(singlePar);
+ owner_->workArea()->redraw(*bv_);
} else {
// Abort updating of the coord
// cache - just restore the old one
- std::swap(theCoords, backup);
+ theCoords.doneUpdating();
}
} else
owner_->workArea()->greyOut();
}
-ViewMetricsInfo BufferView::Pimpl::metrics(bool singlepar)
+void BufferView::Pimpl::updateMetrics(bool singlepar)
{
// Remove old position cache
theCoords.clear();
<< "size: " << size
<< endl;
- return ViewMetricsInfo(pit1, pit2, y1, y2, singlepar, size);
+ metrics_info_ = ViewMetricsInfo(pit1, pit2, y1, y2, singlepar, size);
}