From 52d30225b8aae67a7d54a9cfb1a8b15690e858e1 Mon Sep 17 00:00:00 2001 From: John Levon Date: Tue, 9 Jul 2002 16:19:14 +0000 Subject: [PATCH] add two FIXMEs , little cleanup git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4573 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 44 +++++++++++++++++++++++++++++------------- src/ChangeLog | 3 +++ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 4633d0cc4b..95bf55f1d7 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -259,7 +259,7 @@ bool BufferView::Pimpl::fitCursor() bv_->owner()->getDialogs()->updateParagraph(); if (ret) - updateScrollbar(); + updateScrollbar(); return ret; } @@ -377,6 +377,9 @@ void BufferView::Pimpl::updateScrollbar() } 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()); } @@ -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(); } // always make sure that the scrollbar is sane. updateScrollbar(); - repaint(); owner_->updateLayoutChoice(); return; } @@ -1019,9 +1022,9 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f) if (text->inset_owner) { text->inset_owner->setUpdateStatus(bv_, InsetText::NONE); - updateInset(text->inset_owner, false); + updateInset(text->inset_owner, false); } else { - update(); + update(); } if ((f & FITCUR)) { @@ -1216,7 +1219,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i) bv_->text->setCursor(bv_, par, 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) { ostringstream str; str << _("Moved to bookmark") << ' ' << i; @@ -1295,13 +1298,28 @@ void BufferView::Pimpl::toggleToggle() void BufferView::Pimpl::center() { - beforeChange(bv_->text); - if (bv_->text->cursor.y() > static_cast((workarea().workHeight() / 2))) { - screen().draw(bv_->text, bv_, bv_->text->cursor.y() - workarea().workHeight() / 2); - } else { - screen().draw(bv_->text, bv_, 0); - } - update(bv_->text, BufferView::SELECT|BufferView::FITCUR); + LyXText * t = bv_->text; + + beforeChange(t); + int const half_height = workarea().workHeight() / 2; + int new_y = 0; + + if (t->cursor.y() > half_height) { + new_y = t->cursor.y() - half_height; + } + + // 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); } diff --git a/src/ChangeLog b/src/ChangeLog index 0b2d7deb82..27484466c5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,6 @@ +2002-07-09 John Levon + + * BufferView_pimpl.C: add FIXMEs, clean up a little 2002-07-09 André Pönitz -- 2.39.2