Cleanup. Also added notes about how to fix bug 3440, which I do not propose to do now.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18525 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2007-05-26 17:35:54 +00:00
parent df99a5c933
commit 274b6182f3

View File

@ -183,14 +183,20 @@ void BufferView::setBuffer(Buffer * b)
return; return;
} }
//FIXME Fix for bug 3440 is here.
// If we are closing current buffer, switch to the first in // If we are closing current buffer, switch to the first in
// buffer list. // buffer list.
if (!b) { if (!b) {
LYXERR(Debug::INFO) << BOOST_CURRENT_FUNCTION LYXERR(Debug::INFO) << BOOST_CURRENT_FUNCTION
<< " No Buffer!" << endl; << " No Buffer!" << endl;
// We are closing the buffer, use the first buffer as current // We are closing the buffer, use the first buffer as current
//FIXME 3440
// if (last_buffer_) buffer_ = last_buffer_;
// also check that this is in theBufferList()?
buffer_ = theBufferList().first(); buffer_ = theBufferList().first();
} else { } else {
//FIXME 3440
// last_buffer = buffer_;
// Set current buffer // Set current buffer
buffer_ = b; buffer_ = b;
} }
@ -200,9 +206,11 @@ void BufferView::setBuffer(Buffer * b)
anchor_ref_ = 0; anchor_ref_ = 0;
offset_ref_ = 0; offset_ref_ = 0;
if (buffer_) { if (!buffer_)
return;
LYXERR(Debug::INFO) << BOOST_CURRENT_FUNCTION LYXERR(Debug::INFO) << BOOST_CURRENT_FUNCTION
<< "Buffer addr: " << buffer_ << endl; << "Buffer addr: " << buffer_ << endl;
cursor_.push(buffer_->inset()); cursor_.push(buffer_->inset());
cursor_.resetAnchor(); cursor_.resetAnchor();
buffer_->text().setCurrentFont(cursor_); buffer_->text().setCurrentFont(cursor_);
@ -220,12 +228,8 @@ void BufferView::setBuffer(Buffer * b)
// example if this Buffer has been modified by another view. // example if this Buffer has been modified by another view.
cursor_.fixIfBroken(); cursor_.fixIfBroken();
} }
}
if (buffer_)
updateMetrics(false); updateMetrics(false);
if (graphics::Previews::status() != LyXRC::PREVIEW_OFF)
if (buffer_ && graphics::Previews::status() != LyXRC::PREVIEW_OFF)
graphics::Previews::get().generateBufferPreviews(*buffer_); graphics::Previews::get().generateBufferPreviews(*buffer_);
} }