add two FIXMEs , little cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4573 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-07-09 16:19:14 +00:00
parent 149c1bdfcd
commit 52d30225b8
2 changed files with 33 additions and 12 deletions

View File

@ -378,6 +378,9 @@ void BufferView::Pimpl::updateScrollbar()
LyXText const & t = *bv_->text; LyXText const & t = *bv_->text;
lyxerr[Debug::GUI] << "Updating scrollbar: h " << t.height << ", first_y "
<< t.first_y << ", default height " << t.defaultHeight() << endl;
workarea().setScrollbarParams(t.height, t.first_y, t.defaultHeight()); workarea().setScrollbarParams(t.height, t.first_y, t.defaultHeight());
} }
@ -926,13 +929,13 @@ void BufferView::Pimpl::workAreaResize()
} }
} }
if (widthChange || heightChange) { // FIXME: GUII temporarily we always repaint for xforms' benefit
if (1 || widthChange || heightChange) {
repaint(); repaint();
} }
// always make sure that the scrollbar is sane. // always make sure that the scrollbar is sane.
updateScrollbar(); updateScrollbar();
repaint();
owner_->updateLayoutChoice(); owner_->updateLayoutChoice();
return; return;
} }
@ -1216,7 +1219,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
bv_->text->setCursor(bv_, par, bv_->text->setCursor(bv_, par,
min(par->size(), saved_positions[i].par_pos)); min(par->size(), saved_positions[i].par_pos));
update(bv_->text, BufferView::SELECT|BufferView::FITCUR); update(bv_->text, BufferView::SELECT | BufferView::FITCUR);
if (i > 0) { if (i > 0) {
ostringstream str; ostringstream str;
str << _("Moved to bookmark") << ' ' << i; str << _("Moved to bookmark") << ' ' << i;
@ -1295,13 +1298,28 @@ void BufferView::Pimpl::toggleToggle()
void BufferView::Pimpl::center() void BufferView::Pimpl::center()
{ {
beforeChange(bv_->text); LyXText * t = bv_->text;
if (bv_->text->cursor.y() > static_cast<int>((workarea().workHeight() / 2))) {
screen().draw(bv_->text, bv_, bv_->text->cursor.y() - workarea().workHeight() / 2); beforeChange(t);
} else { int const half_height = workarea().workHeight() / 2;
screen().draw(bv_->text, bv_, 0); int new_y = 0;
if (t->cursor.y() > half_height) {
new_y = t->cursor.y() - half_height;
} }
update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
// FIXME: can we do this w/o calling screen directly ?
// This updates first_y but means the fitCursor() call
// from the update(FITCUR) doesn't realise that we might
// have moved (e.g. from GOTOPARAGRAPH), so doesn't cause
// the scrollbar to be updated as it should, so we have
// to do it manually. Any operation that does a center()
// and also might have moved first_y must make sure to call
// updateScrollbar() currently. Never mind that this is a
// pretty obfuscated way of updating t->first_y
screen().draw(t, bv_, new_y);
update(t, BufferView::SELECT | BufferView::FITCUR);
} }

View File

@ -1,3 +1,6 @@
2002-07-09 John Levon <moz@compsoc.man.ac.uk>
* BufferView_pimpl.C: add FIXMEs, clean up a little
2002-07-09 André Pönitz <poenitz@gmx.net> 2002-07-09 André Pönitz <poenitz@gmx.net>