#include "kbmap.h"
#include "lyxrow.h"
#include "bufferlist.h"
+#include "buffer.h"
#include "BufferView.h"
#include "lyxserver.h"
#include "intl.h"
#include "ParagraphParameters.h"
#include "insets/insetcommand.h"
+#include "insets/insetexternal.h"
#include "insets/insettabular.h"
#include "mathed/formulamacro.h"
case LFUN_INSET_SETTINGS: {
disable = true;
UpdatableInset * inset = view()->theLockingInset();
-
+
if (!inset)
break;
// jump back to owner if an InsetText, so
// we get back to the InsetTabular or whatever
if (inset->lyxCode() == Inset::TEXT_CODE)
- inset = static_cast<UpdatableInset*>(inset->owner());
+ inset = inset->owner();
Inset::Code code = inset->lyxCode();
switch (code) {
case LFUN_TOC_INSERT:
code = Inset::TOC_CODE;
break;
- case LFUN_PARENTINSERT:
- code = Inset::PARENT_CODE;
- break;
case LFUN_HTMLURL:
case LFUN_URL:
code = Inset::URL_CODE;
case LFUN_END_OF_SENTENCE:
code = Inset::SPECIALCHAR_CODE;
break;
- case LFUN_PROTECTEDSPACE:
+ case LFUN_SPACE_INSERT:
// slight hack: we know this is allowed in math mode
if (!mathcursor)
- code = Inset::SPECIALCHAR_CODE;
+ code = Inset::SPACE_CODE;
break;
default:
break;
&& argument.empty()) {
argument = encoded_last_key;
}
+
+ // the insets can't try to handle this,
+ // a table cell in the dummy position will
+ // lock its insettext, the insettext will
+ // pass it the bufferview, and succeed,
+ // so it will stay not locked. Not good
+ // if we've just done LFUN_ESCAPE (which
+ // injects an LFUN_PARAGRAPH_UPDATE)
+ if (action == LFUN_PARAGRAPH_UPDATE) {
+ view()->dispatch(ev);
+ goto exit_with_message;
+ }
+
// Undo/Redo is a bit tricky for insets.
if (action == LFUN_UNDO) {
view()->undo();
string const str = bformat(_("Saving document %1$s..."),
MakeDisplayPath(owner->buffer()->fileName()));
owner->message(str);
- MenuWrite(view(), owner->buffer());
+ MenuWrite(owner->buffer());
owner->message(str + _(" done."));
} else
- WriteAs(view(), owner->buffer());
+ WriteAs(owner->buffer());
break;
case LFUN_WRITEAS:
- WriteAs(view(), owner->buffer(), argument);
+ WriteAs(owner->buffer(), argument);
break;
case LFUN_MENURELOAD: {
owner->getDialogs().showSearch();
break;
- case LFUN_REMOVEERRORS:
- if (view()->removeAutoInsets()) {
-#warning repaint() or update() or nothing ?
- view()->repaint();
- view()->fitCursor();
- }
- break;
-
case LFUN_DEPTH_MIN:
changeDepth(view(), TEXT(false), DEC_DEPTH, false);
owner->view_state_changed();
int id;
istr >> id;
- Paragraph * par = &*owner->buffer()->getParFromID(id);
- if (par == 0) {
+ ParIterator par = owner->buffer()->getParFromID(id);
+ if (par == owner->buffer()->par_iterator_end()) {
lyxerr[Debug::INFO] << "No matching paragraph found! ["
<< id << ']' << endl;
break;
if (view()->theLockingInset())
view()->unlockInset(view()->theLockingInset());
if (par->inInset()) {
- par->inInset()->edit(view());
+ FuncRequest cmd(view(), LFUN_INSET_EDIT, "left");
+ par->inInset()->localDispatch(cmd);
}
// Set the cursor
- view()->getLyXText()->setCursor(par, 0);
+ view()->getLyXText()->setCursor(par.pit(), 0);
view()->switchKeyMap();
owner->view_state_changed();
owner->getDialogs().toggleTooltips();
break;
+ case LFUN_EXTERNAL_EDIT: {
+ InsetExternal()
+ .localDispatch(FuncRequest(view(), action, argument));
+ break;
+ }
+
default:
// Then if it was none of the above
// Trying the BufferView::pimpl dispatch: