resizecon = workarea().workAreaResize
.connect(boost::bind(&BufferView::Pimpl::workAreaResize, this));
dispatchcon = workarea().dispatch
- .connect(boost::bind(&BufferView::Pimpl::dispatch, this, _1));
+ .connect(boost::bind(&BufferView::Pimpl::workAreaDispatch, this, _1));
kpresscon = workarea().workAreaKeyPress
.connect(boost::bind(&BufferView::Pimpl::workAreaKeyPress, this, _1, _2));
selectioncon = workarea().selectionRequested
else if (vbt->cursor.y() > last)
vbt->setCursorFromCoordinates(0, last);
- owner_->updateLayoutChoice();
+ owner_->updateLayoutChoice();
}
{
if (!bv_->theLockingInset() || !bv_->theLockingInset()->nodraw()) {
screen().update(*bv_);
- bool fitc = false;
- while (bv_->text->status() == LyXText::CHANGED_IN_DRAW) {
- bv_->text->fullRebreak();
- bv_->text->setCursor(bv_->text->cursor.par(),
- bv_->text->cursor.pos());
- if (bv_->text->selection.set()) {
- bv_->text->setCursor(bv_->text->selection.start,
- bv_->text->selection.start.par(),
- bv_->text->selection.start.pos());
- bv_->text->setCursor(bv_->text->selection.end,
- bv_->text->selection.end.par(),
- bv_->text->selection.end.pos());
- }
- fitc = true;
- bv_->text->postPaint(0);
- screen().update(*bv_);
- }
-
- // do this here instead of in the screen::update because of
- // the above loop!
bv_->text->clearPaint();
-
- if (fitc)
- fitCursor();
}
}
}
+// Doesn't go through lyxfunc, so we need to update the
+// layout choice etc. ourselves
+bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & ev_in)
+{
+ // e.g. Qt mouse press when no buffer
+ if (!available())
+ return false;
+
+ bool const res = dispatch(ev_in);
+
+ bv_->owner()->updateLayoutChoice();
+ bv_->fitCursor();
+
+ return res;
+}
+
+
bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
{
// Make sure that the cached BufferView is correct.
<< " button[" << ev.button() << ']'
<< endl;
- // e.g. Qt mouse press when no buffer
- if (!buffer_)
- return false;
-
LyXTextClass const & tclass = buffer_->params.getLyXTextClass();
switch (ev.action) {
case LFUN_INSET_APPLY: {
string const name = ev.getArg(0);
- InsetBase * base = owner_->getDialogs().getOpenInset(name);
- if (base) {
+ InsetBase * inset = owner_->getDialogs().getOpenInset(name);
+ if (inset) {
// This works both for 'original' and 'mathed' insets.
// Note that the localDispatch performs updateInset
// also.
FuncRequest fr(bv_, LFUN_INSET_MODIFY, ev.argument);
- base->localDispatch(fr);
+ inset->localDispatch(fr);
} else {
- Inset * inset = createInset(ev);
- if (inset && insertInset(inset)) {
- updateInset(inset);
- } else {
- delete inset;
- }
+ FuncRequest fr(bv_, LFUN_INSET_INSERT, ev.argument);
+ dispatch(fr);
}
+ }
+ break;
+
+ case LFUN_INSET_INSERT: {
+ Inset * inset = createInset(ev);
+ if (inset && insertInset(inset)) {
+ updateInset(inset);
- if (name == "bibitem") {
- // We need to do a redraw because the maximum
- // InsetBibitem width could have changed
+ string const name = ev.getArg(0);
+ if (name == "bibitem") {
+ // We need to do a redraw because the maximum
+ // InsetBibitem width could have changed
#warning please check you mean repaint() not update(),
#warning and whether the repaint() is needed at all
- bv_->repaint();
- bv_->fitCursor();
+ bv_->repaint();
+ bv_->fitCursor();
+ }
+ } else {
+ delete inset;
}
}
break;
-
+
case LFUN_FLOAT_LIST:
if (tclass.floats().typeExist(ev.argument)) {
Inset * inset = new InsetFloatList(ev.argument);
}
}
- bv_->owner()->getDialogs().showThesaurus(arg);
+ bv_->owner()->getDialogs().show("thesaurus", arg);
}
break;