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();
}
}
+// 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;