From fa2f8d159b569b1dea10c36d7a9658c3af69ddc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Sun, 27 Apr 2008 16:20:12 +0000 Subject: [PATCH] * merge LFUN_EDIT_EXTERNAL and LFUN_EDIT_GRAPHICS to one LFUN_EDIT_INSET (bug 3975) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24526 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 28 ++++++++++++---------------- src/FuncCode.h | 30 ++++++++++++++---------------- src/LyXAction.cpp | 12 +++++++++--- src/LyXFunc.cpp | 3 +-- src/frontends/qt4/GuiExternal.cpp | 2 +- src/insets/InsetExternal.cpp | 4 ++-- src/insets/InsetGraphics.cpp | 4 ++-- 7 files changed, 41 insertions(+), 42 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 092a81f13d..de9e950a00 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -851,8 +851,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd) case LFUN_FONT_STATE: case LFUN_LABEL_INSERT: case LFUN_INFO_INSERT: - case LFUN_EXTERNAL_EDIT: - case LFUN_GRAPHICS_EDIT: + case LFUN_INSET_EDIT: case LFUN_PARAGRAPH_GOTO: case LFUN_NOTE_NEXT: case LFUN_REFERENCE_NEXT: @@ -1063,23 +1062,20 @@ bool BufferView::dispatch(FuncRequest const & cmd) break; } - case LFUN_EXTERNAL_EDIT: { + case LFUN_INSET_EDIT: { FuncRequest fr(cmd); - InsetExternal * inset = getInsetByCode(d->cursor_, - EXTERNAL_CODE); + // if there is an inset at cursor, see whether it + // can be modified. + Inset * inset = cur.nextInset(); if (inset) - inset->dispatch(d->cursor_, fr); - break; - } + inset->dispatch(cur, fr); + // if it did not work, try the underlying inset. + if (!inset || !cur.result().dispatched()) + cur.dispatch(cmd); - - case LFUN_GRAPHICS_EDIT: { - FuncRequest fr(cmd); - InsetGraphics * inset = getInsetByCode(d->cursor_, - GRAPHICS_CODE); - if (inset) - inset->dispatch(d->cursor_, fr); - break; + if (!cur.result().dispatched()) + // It did not work too; no action needed. + break; } case LFUN_PARAGRAPH_GOTO: { diff --git a/src/FuncCode.h b/src/FuncCode.h index 71f800a9af..4619551357 100644 --- a/src/FuncCode.h +++ b/src/FuncCode.h @@ -306,7 +306,7 @@ enum FuncCode LFUN_PARAGRAPH_PARAMS_APPLY, LFUN_PARAGRAPH_UPDATE, // 230 - LFUN_EXTERNAL_EDIT, + LFUN_INSET_EDIT, // JSpitzm 20080427 LFUN_BRANCH_INSERT, LFUN_BOX_INSERT, LFUN_LINE_INSERT, @@ -331,87 +331,85 @@ enum FuncCode LFUN_BUFFER_PARAMS_APPLY, // 250 LFUN_LYXRC_APPLY, - LFUN_GRAPHICS_EDIT, LFUN_BUFFER_NEXT, LFUN_BUFFER_PREVIOUS, LFUN_STATISTICS, - // 255 LFUN_CHANGES_OUTPUT, // jspitzm 20050121 + // 255 LFUN_BIBTEX_DATABASE_ADD, LFUN_BIBTEX_DATABASE_DEL, LFUN_CITATION_INSERT, LFUN_OUTLINE_UP, - // 260 LFUN_OUTLINE_DOWN, + // 260 LFUN_OUTLINE_IN, LFUN_OUTLINE_OUT, LFUN_PARAGRAPH_MOVE_DOWN, LFUN_PARAGRAPH_MOVE_UP, - // 265 LFUN_BUFFER_TOGGLE_COMPRESSION, // bpeng 20060427 + // 265 LFUN_MATH_BIGDELIM, LFUN_CLIPBOARD_PASTE, LFUN_INSET_DISSOLVE, // jspitzm 20060807 LFUN_CHANGE_NEXT, - // 270 LFUN_WINDOW_NEW, // Abdel 20061021 + // 270 LFUN_WINDOW_CLOSE, // Abdel 20061023 LFUN_UNICODE_INSERT, // Lgb 20061022 LFUN_BOOKMARK_CLEAR, // bpeng 20061031 LFUN_NOMENCL_INSERT, // Ugras - // 275 LFUN_NOMENCL_PRINT, // Ugras + // 275 LFUN_LISTING_INSERT, // Herbert 20011110, bpeng 20070502 LFUN_TOOLBAR_TOGGLE, // Edwin 20070521 LFUN_BUFFER_WRITE_ALL, // rgh, gpothier 200707XX LFUN_PARAGRAPH_PARAMS, - // 280 LFUN_LAYOUT_MODULES_CLEAR, + // 280 LFUN_LAYOUT_MODULE_ADD, LFUN_LAYOUT_RELOAD, LFUN_MASTER_BUFFER_VIEW, // Tommaso, 20070920 LFUN_MASTER_BUFFER_UPDATE, // Tommaso, 20070920 - // 285 LFUN_INFO_INSERT, // bpeng, 20071007 + // 285 LFUN_CALL, // broider, 20071002 LFUN_CHAR_LEFT, // dov, 20071022 LFUN_CHAR_LEFT_SELECT, // dov, 20071022 LFUN_CHAR_RIGHT, // dov, 20071022 - // 290 LFUN_CHAR_RIGHT_SELECT, // dov, 20071022 + // 290 LFUN_FINISHED_BACKWARD, // dov, 20071022 LFUN_FINISHED_FORWARD, // dov, 20071022 LFUN_WORD_LEFT, // dov, 20071028 LFUN_WORD_LEFT_SELECT, // dov, 20071028 - // 295 LFUN_WORD_RIGHT, // dov, 20071028 + // 295 LFUN_WORD_RIGHT_SELECT, // dov, 20071028 LFUN_MATH_MACRO_FOLD, LFUN_MATH_MACRO_UNFOLD, LFUN_MATH_MACRO_ADD_PARAM, - // 300 LFUN_MATH_MACRO_REMOVE_PARAM, + // 300 LFUN_MATH_MACRO_APPEND_GREEDY_PARAM, LFUN_MATH_MACRO_REMOVE_GREEDY_PARAM, LFUN_MATH_MACRO_MAKE_OPTIONAL, LFUN_MATH_MACRO_MAKE_NONOPTIONAL, - // 305 LFUN_MATH_MACRO_ADD_OPTIONAL_PARAM, + // 305 LFUN_MATH_MACRO_REMOVE_OPTIONAL_PARAM, LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM, LFUN_IN_MATHMACROTEMPLATE, LFUN_SCROLL, - // 310 LFUN_UI_TOGGLE, + // 310 LFUN_SPLIT_VIEW, LFUN_CLOSE_TAB_GROUP, LFUN_COMPLETION_POPUP, LFUN_COMPLETION_INLINE, - // 315 LFUN_COMPLETION_COMPLETE, + // 315 LFUN_NEXT_INSET_MODIFY, // JSpitzm 20080323 LFUN_LASTACTION // end of the table - // 319 }; diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 92f8173113..e82e0b82c5 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -1092,9 +1092,15 @@ void LyXAction::init() * \endvar */ { LFUN_OUTLINE_OUT, "outline-out", Noop, Edit }, - - { LFUN_EXTERNAL_EDIT, "external-edit", Noop, Edit }, - { LFUN_GRAPHICS_EDIT, "graphics-edit", Noop, Edit }, +/*! + * \var lyx::FuncCode lyx::LFUN_INSET_EDIT + * \li Action: Edit the inset at cursor with an external application, + * if one is attributed. + * \li Syntax: inset-edit + * \li Origin: JSpitzm, 27 Apr 2006 + * \endvar + */ + { LFUN_INSET_EDIT, "inset-edit", Noop, Edit }, { LFUN_CELL_BACKWARD, "cell-backward", Noop, Edit }, { LFUN_CELL_FORWARD, "cell-forward", Noop, Edit }, diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 7433a2ac66..a2689cee34 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -622,8 +622,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const case LFUN_SCREEN_FONT_UPDATE: case LFUN_SET_COLOR: case LFUN_MESSAGE: - case LFUN_EXTERNAL_EDIT: - case LFUN_GRAPHICS_EDIT: + case LFUN_INSET_EDIT: case LFUN_ALL_INSETS_TOGGLE: case LFUN_BUFFER_LANGUAGE: case LFUN_TEXTCLASS_APPLY: diff --git a/src/frontends/qt4/GuiExternal.cpp b/src/frontends/qt4/GuiExternal.cpp index 1e0ebfc899..8bbf4f5313 100644 --- a/src/frontends/qt4/GuiExternal.cpp +++ b/src/frontends/qt4/GuiExternal.cpp @@ -702,7 +702,7 @@ void GuiExternal::editExternal() { applyView(); string const lfun = InsetExternal::params2string(params_, buffer()); - dispatch(FuncRequest(LFUN_EXTERNAL_EDIT, lfun)); + dispatch(FuncRequest(LFUN_INSET_EDIT, lfun)); } diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index 643e1e2abb..29eded4ab9 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -427,7 +427,7 @@ void InsetExternal::doDispatch(Cursor & cur, FuncRequest & cmd) { switch (cmd.action) { - case LFUN_EXTERNAL_EDIT: { + case LFUN_INSET_EDIT: { InsetExternalParams p = params(); if (!cmd.argument().empty()) string2params(to_utf8(cmd.argument()), buffer(), p); @@ -465,7 +465,7 @@ bool InsetExternal::getStatus(Cursor & cur, FuncRequest const & cmd, { switch (cmd.action) { - case LFUN_EXTERNAL_EDIT: + case LFUN_INSET_EDIT: case LFUN_INSET_MODIFY: case LFUN_INSET_DIALOG_UPDATE: flag.enabled(true); diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 51a527fa0c..0a447debd6 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -184,7 +184,7 @@ InsetGraphics::~InsetGraphics() void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd) { switch (cmd.action) { - case LFUN_GRAPHICS_EDIT: { + case LFUN_INSET_EDIT: { InsetGraphicsParams p = params(); if (!cmd.argument().empty()) string2params(to_utf8(cmd.argument()), buffer(), p); @@ -224,7 +224,7 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & flag) const { switch (cmd.action) { - case LFUN_GRAPHICS_EDIT: + case LFUN_INSET_EDIT: case LFUN_INSET_MODIFY: case LFUN_INSET_DIALOG_UPDATE: flag.enabled(true);