X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfunc.C;h=bf551cd8b55ba52548abb52d28b459770eb39c6b;hb=a9713c5563c924f4ab98bde3d9f24a5c1e4dd50e;hp=bcff99a8ef3d111839b29c8569e69c4db6d9be3d;hpb=dbef37d5223a727b860a83ff4155f05b013c97a3;p=lyx.git diff --git a/src/lyxfunc.C b/src/lyxfunc.C index bcff99a8ef..bf551cd8b5 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -15,6 +15,7 @@ #include "kbmap.h" #include "lyxrow.h" #include "bufferlist.h" +#include "buffer.h" #include "BufferView.h" #include "lyxserver.h" #include "intl.h" @@ -43,6 +44,7 @@ #include "ParagraphParameters.h" #include "insets/insetcommand.h" +#include "insets/insetexternal.h" #include "insets/insettabular.h" #include "mathed/formulamacro.h" @@ -490,7 +492,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const case LFUN_INSET_SETTINGS: { disable = true; UpdatableInset * inset = view()->theLockingInset(); - + if (!inset) break; @@ -500,7 +502,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const // 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(inset->owner()); + inset = inset->owner(); Inset::Code code = inset->lyxCode(); switch (code) { @@ -644,9 +646,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const 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; @@ -663,10 +662,10 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const 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; @@ -836,6 +835,19 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) && 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(); @@ -1045,14 +1057,14 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) 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: { @@ -1126,14 +1138,6 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) 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(); @@ -1353,8 +1357,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) 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; @@ -1366,10 +1370,11 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) 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(); @@ -1584,6 +1589,12 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) 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: