#include "mathed/formulabase.h"
+#include "graphics/Previews.h"
+
#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/filetools.h"
owner_->updateToolbar();
owner_->updateLayoutChoice();
owner_->updateWindowTitle();
+
+ if (grfx::Previews::activated() && buffer_)
+ grfx::Previews::get().generateBufferPreviews(buffer_);
}
bv_->owner()->getDialogs()->updateParagraph();
if (ret)
- updateScrollbar();
+ updateScrollbar();
return ret;
}
}
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());
}
void BufferView::Pimpl::workAreaResize()
{
static int work_area_width;
- static unsigned int work_area_height;
+ static int work_area_height;
bool const widthChange = workarea().workWidth() != work_area_width;
bool const heightChange = workarea().workHeight() != work_area_height;
}
}
- if (widthChange || heightChange) {
+ // FIXME: GUII temporarily we always repaint for xforms' benefit
+ if (1 || widthChange || heightChange) {
repaint();
}
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)) {
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;
void BufferView::Pimpl::center()
{
- beforeChange(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);
- } 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);
}
void BufferView::Pimpl::insertAndEditInset(Inset * inset)
{
+#if 0
if (insertInset(inset))
inset->edit(bv_);
else
delete inset;
+#else
+ bool gotsel = false;
+
+ if (bv_->getLyXText()->selection.set()) {
+ bv_->getLyXText()->cutSelection(bv_, true, false);
+ gotsel = true;
+ }
+
+ if (insertInset(inset)) {
+ inset->edit(bv_);
+ if (gotsel)
+ owner_->getLyXFunc()->dispatch(LFUN_PASTESELECTION);
+ }
+ else
+ delete inset;
+#endif
}