diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 61a39ed1fd..0d581c4766 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -16,11 +16,15 @@ The following variables are obsoleted in 2.0 The following new LyX functions have been introduced: -- LFUN_WORD_FINDAD, "word-findadv". +- LFUN_WORD_FINDAD ("word-findadv"). -- LFUN_REGEXP_MODE, "regexp-mode". +- LFUN_REGEXP_MODE ("regexp-mode"). -- LFUN_COPY_LABEL_AS_REF, "copy-label-as-reference" +- LFUN_COPY_LABEL_AS_REF ("copy-label-as-reference"). + +The following LyX functions have been removed: + +- LFUN_NEXT_INSET_TOGGLE (next-inset-toggle): use "inset-toggle" instead. Known issues in version 2.0.0 ----------------------------- diff --git a/lib/bind/aqua.bind b/lib/bind/aqua.bind index f8c9280c6b..aa2adf80bb 100644 --- a/lib/bind/aqua.bind +++ b/lib/bind/aqua.bind @@ -80,7 +80,7 @@ \bind "M-~S-e s" "spellchecker" \bind "M-~S-e h" "buffer-chktex" \bind "M-~S-e e" "error-remove-all" -\bind "M-~S-e l" "next-inset-toggle" +\bind "M-~S-e l" "inset-toggle" \bind "M-~S-e p" "dialog-preferences" \bind "M-~S-e r" "reconfigure" diff --git a/lib/bind/cua.bind b/lib/bind/cua.bind index 5bf17c4042..8d903f5bf2 100644 --- a/lib/bind/cua.bind +++ b/lib/bind/cua.bind @@ -70,7 +70,7 @@ \bind "C-f" "dialog-show findreplace" \bind "C-S-f" "dialog-show findreplaceadv" -\bind "C-i" "next-inset-toggle" # 'i' for Inset +\bind "C-i" "inset-toggle" # 'i' for Inset \bind "C-c" "copy" \bind "C-x" "cut" diff --git a/lib/bind/emacs.bind b/lib/bind/emacs.bind index 34188bfb72..89ae028c7c 100644 --- a/lib/bind/emacs.bind +++ b/lib/bind/emacs.bind @@ -43,7 +43,7 @@ \bind "C-l" "screen-recenter" \bind "C-m" "mark-toggle" \bind "C-n" "down" -\bind "C-o" "next-inset-toggle" +\bind "C-o" "inset-toggle" \bind "C-p" "up" # this is "quoted-insert" a total different meaning from "quote-insert" diff --git a/lib/bind/mac.bind b/lib/bind/mac.bind index bfa53e4a75..e930dc51b0 100644 --- a/lib/bind/mac.bind +++ b/lib/bind/mac.bind @@ -52,7 +52,7 @@ \bind "C-S-M" "math-display" \bind "C-f" "dialog-show findreplace" -\bind "C-i" "next-inset-toggle" # 'i' for Inset +\bind "C-i" "inset-toggle" # 'i' for Inset \bind "C-c" "copy" \bind "C-x" "cut" diff --git a/lib/bind/xemacs.bind b/lib/bind/xemacs.bind index f0e684269c..4894279824 100644 --- a/lib/bind/xemacs.bind +++ b/lib/bind/xemacs.bind @@ -45,7 +45,7 @@ \bind "C-l" "screen-recenter" \bind "C-m" "mark-toggle" \bind "C-n" "down" -\bind "C-o" "next-inset-toggle" +\bind "C-o" "inset-toggle" \bind "C-p" "up" # this is "quoted-insert" a total different meaning from "quote-insert" diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc index 9523bcbdf1..82c85e3de8 100644 --- a/lib/ui/stdcontext.inc +++ b/lib/ui/stdcontext.inc @@ -80,7 +80,7 @@ Menuset Item " on page |f" "next-inset-modify changetype vref" Item "Formatted reference|t" "next-inset-modify changetype prettyref" Separator - Item "Settings...|S" "next-inset-toggle" + Item "Settings...|S" "inset-toggle" End # @@ -92,7 +92,7 @@ Menuset Separator Item "Copy as Reference|C" "copy-label-as-reference" Separator - Item "Settings...|S" "next-inset-toggle" + Item "Settings...|S" "inset-toggle" End @@ -102,7 +102,7 @@ Menuset Menu "context-citation" CiteStyles Separator - Item "Settings...|S" "next-inset-toggle" + Item "Settings...|S" "inset-toggle" End @@ -110,7 +110,7 @@ Menuset # InsetBibtex context menu # Menu "context-bibtex" - Item "Settings...|S" "next-inset-toggle" + Item "Settings...|S" "inset-toggle" Separator Item "Edit Database(s) externally...|x" "inset-edit" End @@ -120,15 +120,15 @@ Menuset # InsetCollapsable context menu # Menu "context-collapsable" - OptItem "Open Inset|O" "next-inset-toggle open" - OptItem "Close Inset|C" "next-inset-toggle close" + OptItem "Open Inset|O" "inset-toggle open" + OptItem "Close Inset|C" "inset-toggle close" Separator Item "Dissolve Inset|D" "inset-dissolve" OptItem "Settings...|S" "inset-settings" End Menu "context-conglomerate" - Item "Toggle Label|L" "next-inset-toggle" + Item "Toggle Label|L" "inset-toggle" Item "Dissolve Inset|D" "inset-dissolve charstyle" Separator OptItem "Settings...|S" "inset-settings" @@ -148,8 +148,8 @@ Menuset Item "Shaded background|b" "next-inset-modify changetype Shaded" Item "Double frame|u" "next-inset-modify changetype Doublebox" Separator - OptItem "Open Inset|O" "next-inset-toggle open" - OptItem "Close Inset|C" "next-inset-toggle close" + OptItem "Open Inset|O" "inset-toggle open" + OptItem "Close Inset|C" "inset-toggle close" Separator Item "Dissolve Inset|D" "inset-dissolve" Item "Settings...|S" "inset-settings box" @@ -164,8 +164,8 @@ Menuset Item "Comment|m" "next-inset-modify note Note Comment" Item "Greyed Out|G" "next-inset-modify note Note Greyedout" Separator - OptItem "Open Inset|O" "next-inset-toggle open" - OptItem "Close Inset|C" "next-inset-toggle close" + OptItem "Open Inset|O" "inset-toggle open" + OptItem "Close Inset|C" "inset-toggle close" Separator Item "Dissolve Inset|D" "inset-dissolve" End @@ -202,9 +202,9 @@ Menuset Item "Horizontal Fill (Right Arrow)|g" "next-inset-modify space \rightarrowfill{}" Item "Horizontal Fill (Up Brace)|p" "next-inset-modify space \upbracefill{}" Item "Horizontal Fill (Down Brace)|B" "next-inset-modify space \downbracefill{}" - Item "Custom Length|C" "command-sequence next-inset-modify space \hspace{} \length 1in; next-inset-toggle" + Item "Custom Length|C" "command-sequence next-inset-modify space \hspace{} \length 1in; inset-toggle" Separator - Item "Settings...|S" "next-inset-toggle" + Item "Settings...|S" "inset-toggle" End # @@ -220,9 +220,9 @@ Menuset Item "Half Quad Space (Enskip)|k" "next-inset-modify mathspace \enskip{}" Item "Quad Space|Q" "next-inset-modify mathspace \quad{}" Item "Double Quad Space|u" "next-inset-modify mathspace \qquad{}" - Item "Custom Length|C" "command-sequence next-inset-modify mathspace \hspace{} \length 1in; next-inset-toggle" + Item "Custom Length|C" "command-sequence next-inset-modify mathspace \hspace{} \length 1in; inset-toggle" Separator - Item "Settings...|S" "next-inset-toggle" + Item "Settings...|S" "inset-toggle" End # @@ -234,9 +234,9 @@ Menuset Item "MedSkip|M" "next-inset-modify vspace medskip" Item "BigSkip|B" "next-inset-modify vspace bigskip" Item "VFill|F" "next-inset-modify vspace vfill" - Item "Custom|C" "command-sequence next-inset-modify vspace 1in; next-inset-toggle" + Item "Custom|C" "command-sequence next-inset-modify vspace 1in; inset-toggle" Separator - Item "Settings...|e" "next-inset-toggle" + Item "Settings...|e" "inset-toggle" End # @@ -249,7 +249,7 @@ Menuset Item "Verbatim (marked blanks)|b" "next-inset-modify changetype verbatiminput*" Item "Listing|L" "next-inset-modify changetype lstinputlisting" Separator - Item "Settings...|S" "next-inset-toggle" + Item "Settings...|S" "inset-toggle" Separator Item "Edit included file...|E" "inset-edit" End @@ -327,8 +327,8 @@ Menuset Item "Paste" "paste" Submenu "Paste Recent|e" "edit_pasterecent" Separator - OptItem "Open Inset|O" "next-inset-toggle open" - OptItem "Close Inset|C" "next-inset-toggle close" + OptItem "Open Inset|O" "inset-toggle open" + OptItem "Close Inset|C" "inset-toggle close" Separator Item "Dissolve Inset|D" "inset-dissolve" Item "Settings...|S" "inset-settings listings" @@ -339,7 +339,7 @@ Menuset # Menu "context-graphics" - Item "Settings...|S" "next-inset-toggle" + Item "Settings...|S" "inset-toggle" Separator Item "Edit externally...|x" "inset-edit" Separator @@ -351,7 +351,7 @@ Menuset # Menu "context-external" - Item "Settings...|S" "next-inset-toggle" + Item "Settings...|S" "inset-toggle" Separator Item "Edit externally...|x" "inset-edit" End diff --git a/src/BufferView.cpp b/src/BufferView.cpp index ad4e15fb28..c79a51deca 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -953,12 +953,10 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd) break; } - case LFUN_NEXT_INSET_TOGGLE: case LFUN_NEXT_INSET_MODIFY: { // this is the real function we want to invoke FuncRequest tmpcmd = cmd; - tmpcmd.action = (cmd.action == LFUN_NEXT_INSET_TOGGLE) - ? LFUN_INSET_TOGGLE : LFUN_INSET_MODIFY; + tmpcmd.action = LFUN_INSET_MODIFY; // if there is an inset at cursor, see whether it // handles the lfun, other start from scratch Inset * inset = cur.nextInset(); @@ -1411,35 +1409,6 @@ bool BufferView::dispatch(FuncRequest const & cmd) processUpdateFlags(Update::SinglePar | Update::FitCursor); break; } - case LFUN_NEXT_INSET_TOGGLE: { - // create the the real function we want to invoke - FuncRequest tmpcmd = cmd; - tmpcmd.action = LFUN_INSET_TOGGLE; - // if there is an inset at cursor, see whether it - // wants to toggle. - Inset * inset = cur.nextInset(); - if (inset) { - if (inset->isActive()) { - Cursor tmpcur = cur; - tmpcur.pushBackward(*inset); - inset->dispatch(tmpcur, tmpcmd); - if (tmpcur.result().dispatched()) - cur.dispatched(); - } else - inset->dispatch(cur, tmpcmd); - } - // if it did not work, try the underlying inset. - if (!inset || !cur.result().dispatched()) - cur.dispatch(tmpcmd); - - if (!cur.result().dispatched()) - // It did not work too; no action needed. - break; - cur.clearSelection(); - processUpdateFlags(Update::SinglePar | Update::FitCursor); - break; - } - case LFUN_NEXT_INSET_MODIFY: { // create the the real function we want to invoke FuncRequest tmpcmd = cmd; diff --git a/src/FuncCode.h b/src/FuncCode.h index f35ed20d3f..5365c4df28 100644 --- a/src/FuncCode.h +++ b/src/FuncCode.h @@ -322,105 +322,104 @@ enum FuncCode LFUN_WORD_REPLACE, LFUN_BUFFER_EXPORT_CUSTOM, LFUN_BUFFER_PRINT, - LFUN_NEXT_INSET_TOGGLE, - // 245 LFUN_ALL_INSETS_TOGGLE, + // 245 LFUN_BUFFER_LANGUAGE, LFUN_TEXTCLASS_APPLY, LFUN_TEXTCLASS_LOAD, LFUN_BUFFER_SAVE_AS_DEFAULT, - // 250 LFUN_BUFFER_PARAMS_APPLY, + // 250 LFUN_LYXRC_APPLY, 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_COMPLETION_POPUP, - // 310 LFUN_COMPLETION_INLINE, + // 310 LFUN_COMPLETION_COMPLETE, LFUN_SET_GRAPHICS_GROUP, LFUN_COMPLETION_CANCEL, LFUN_COMPLETION_ACCEPT, - // 315 LFUN_COMMAND_ALTERNATIVES, + // 315 LFUN_TAB_INSERT, LFUN_TAB_DELETE, LFUN_WORD_FINDADV, // Tommaso, 20081003 LFUN_REGEXP_MODE, // Tommaso, 20081003 - // 320 LFUN_COPY_LABEL_AS_REF, // sts, 20081116 + // 320 LFUN_VC_COMMAND, LFUN_MATH_FONT_STYLE, LFUN_PHANTOM_INSERT, // uwestoehr, 20090130 LFUN_INSET_BEGIN, // JMarc, 20090316 - // 325 LFUN_INSET_END, // JMarc, 20090316 + // 325 LFUN_INSET_BEGIN_SELECT, // JMarc, 20090316 LFUN_INSET_END_SELECT, // JMarc, 20090316 LFUN_SCREEN_SHOW_CURSOR, // vfr, 20090325 diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 8ce60efa26..577cbde42c 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -2238,33 +2238,18 @@ void LyXAction::init() * \endvar */ { LFUN_INSET_SETTINGS, "inset-settings", ReadOnly, Edit }, -/*! - * \var lyx::FuncCode lyx::LFUN_NEXT_INSET_TOGGLE - * \li Action: Toggles the inset at cursor position. For collapsables, this means it will - be (un-)collapsed, in case of other insets, the editing widget (dialog) will - be entered. Also cf. #LFUN_INSET_SETTINGS. - * \li Notion: Used for bibitem, bibtex, box, branch, command, ert, external, - floats, graphics, include, label, listings, note, - phantom, ref, space, tabular, vspace, wrap insets. - * \li Syntax: next-inset-toggle - * \li Params: : these are passed as arguments to #LFUN_INSET_TOGGLE . - * \li Origin: leeming, 30 Mar 2004 - * \endvar - */ - { LFUN_NEXT_INSET_TOGGLE, "next-inset-toggle", ReadOnly, Edit }, /*! * \var lyx::FuncCode lyx::LFUN_INSET_TOGGLE * \li Action: Toggles the collapsable inset we are currently in. * \li Syntax: inset-toggle [] * \li Params: : . \n - open/close/toggle are for collapsable insets. close can be currently used - by #LFUN_NEXT_INSET_TOGGLE. toggle is used when no argument is given.\n + open/close/toggle are for collapsable insets. toggle is used when no argument is given.\n assign synchronize the branch-inset with activation status of the branch. Used for global toggling when changed activation. * \li Origin: lasgouttes, 19 Jul 2001 * \endvar */ - { LFUN_INSET_TOGGLE, "inset-toggle", ReadOnly, Hidden }, + { LFUN_INSET_TOGGLE, "inset-toggle", ReadOnly | AtPoint, Hidden }, /*! * \var lyx::FuncCode lyx::LFUN_ALL_INSETS_TOGGLE * \li Action: Toggles (open/closes) all collapsable insets (of a given type) in the document. diff --git a/src/LyXAction.h b/src/LyXAction.h index 286afac16f..5203bc4fcd 100644 --- a/src/LyXAction.h +++ b/src/LyXAction.h @@ -68,7 +68,8 @@ public: NoBuffer = 2, //< Can be used when there is no document open Argument = 4, //< Requires argument NoUpdate = 8, //< Does not (usually) require update - SingleParUpdate = 16 //< Usually only requires this par updated + SingleParUpdate = 16, //< Usually only requires this par updated + AtPoint = 32, //< dispatch first to inset at cursor if there is one }; LyXAction(); diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index b56dabbd39..d42b70b5b5 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -659,6 +659,13 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const enable = false; break; } + + // Is this a function that acts on inset at point? + Inset * inset = view()->cursor().nextInset(); + if (lyxaction.funcHasFlag(cmd.action, LyXAction::AtPoint) + && inset && inset->getStatus(view()->cursor(), cmd, flag)) + break; + if (!getLocalStatus(view()->cursor(), cmd, flag)) flag = view()->getStatus(cmd); } @@ -1705,6 +1712,20 @@ void LyXFunc::dispatch(FuncRequest const & cmd) break; } + // Is this a function that acts on inset at point? + Inset * inset = view()->cursor().nextInset(); + if (lyxaction.funcHasFlag(action, LyXAction::AtPoint) + && inset) { + view()->cursor().result().dispatched(true); + view()->cursor().result().update(Update::FitCursor | Update::Force); + FuncRequest tmpcmd = cmd; + inset->dispatch(view()->cursor(), tmpcmd); + if (view()->cursor().result().dispatched()) { + updateFlags = view()->cursor().result().update(); + break; + } + } + // Let the current Cursor dispatch its own actions. Cursor old = view()->cursor(); view()->cursor().getPos(cursorPosBeforeDispatchX_,