From a00fbcd8711e7dfa75d2d468dd77e56afcb508ca Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 11 Jan 2010 15:50:07 +0000 Subject: [PATCH 1/1] get rid of next-inset-modify ; inset-modify does the same now git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32965 a592a061-630c-0410-9148-cb99ea01b6c8 --- RELEASE-NOTES | 2 + lib/ui/stdcontext.inc | 132 +++++++++++++++++----------------- src/BufferView.cpp | 37 ---------- src/FuncCode.h | 3 +- src/LyXAction.cpp | 23 ++---- src/frontends/qt4/GuiInfo.cpp | 2 +- src/frontends/qt4/Menus.cpp | 6 +- 7 files changed, 79 insertions(+), 126 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c4c26375bd..e78ae96ecb 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -75,6 +75,8 @@ The following LyX functions have been removed: - LFUN_NEXT_INSET_TOGGLE ("next-inset-toggle"): use "inset-toggle" instead. +- LFUN_NEXT_INSET_MODIFY ("next-inset-modify"): use "inset-modify" instead. + - LFUN_PARAGRAPH_SPACING ("paragraph-spacing"): use "paragraph-params" instead. diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc index e23a01e783..8048435ba6 100644 --- a/lib/ui/stdcontext.inc +++ b/lib/ui/stdcontext.inc @@ -85,12 +85,12 @@ Menuset Item "Next Cross-Reference|N" "reference-next" Item "Go to Label|G" "label-goto" Separator - Item "|R" "next-inset-modify changetype ref" - Item "()|e" "next-inset-modify changetype eqref" - Item "|P" "next-inset-modify changetype pageref" - Item "On Page |O" "next-inset-modify changetype vpageref" - Item " on Page |f" "next-inset-modify changetype vref" - Item "Formatted Reference|t" "next-inset-modify changetype prettyref" + Item "|R" "inset-modify changetype ref" + Item "()|e" "inset-modify changetype eqref" + Item "|P" "inset-modify changetype pageref" + Item "On Page |O" "inset-modify changetype vpageref" + Item " on Page |f" "inset-modify changetype vref" + Item "Formatted Reference|t" "inset-modify changetype prettyref" Separator Item "Settings...|S" "inset-settings" End @@ -151,14 +151,14 @@ Menuset # Menu "context-box" - Item "Frameless|l" "next-inset-modify changetype Frameless" - Item "Simple Frame|F" "next-inset-modify changetype Boxed" - Item "Simple Frame, Page Breaks|P" "next-inset-modify changetype Framed" - Item "Oval, Thin|a" "next-inset-modify changetype ovalbox" - Item "Oval, Thick|v" "next-inset-modify changetype Ovalbox" - Item "Drop Shadow|w" "next-inset-modify changetype Shadowbox" - Item "Shaded Background|B" "next-inset-modify changetype Shaded" - Item "Double Frame|u" "next-inset-modify changetype Doublebox" + Item "Frameless|l" "inset-modify changetype Frameless" + Item "Simple Frame|F" "inset-modify changetype Boxed" + Item "Simple Frame, Page Breaks|P" "inset-modify changetype Framed" + Item "Oval, Thin|a" "inset-modify changetype ovalbox" + Item "Oval, Thick|v" "inset-modify changetype Ovalbox" + Item "Drop Shadow|w" "inset-modify changetype Shadowbox" + Item "Shaded Background|B" "inset-modify changetype Shaded" + Item "Double Frame|u" "inset-modify changetype Doublebox" Separator OptItem "Open Inset|O" "inset-toggle open" OptItem "Close Inset|C" "inset-toggle close" @@ -172,9 +172,9 @@ Menuset # Menu "context-note" - Item "LyX Note|N" "next-inset-modify note Note Note" - Item "Comment|m" "next-inset-modify note Note Comment" - Item "Greyed Out|G" "next-inset-modify note Note Greyedout" + Item "LyX Note|N" "inset-modify note Note Note" + Item "Comment|m" "inset-modify note Note Comment" + Item "Greyed Out|G" "inset-modify note Note Greyedout" Separator OptItem "Open Inset|O" "inset-toggle open" OptItem "Close Inset|C" "inset-toggle close" @@ -190,9 +190,9 @@ Menuset # Menu "context-phantom" - Item "Phantom" "next-inset-modify phantom Phantom Phantom" - Item "Horiz. Phantom" "next-inset-modify phantom Phantom HPhantom" - Item "Vert. Phantom" "next-inset-modify phantom Phantom VPhantom" + Item "Phantom" "inset-modify phantom Phantom Phantom" + Item "Horiz. Phantom" "inset-modify phantom Phantom HPhantom" + Item "Vert. Phantom" "inset-modify phantom Phantom VPhantom" Separator Item "Dissolve Inset|D" "inset-dissolve" End @@ -201,23 +201,23 @@ Menuset # InsetSpace context menu # Menu "context-space" - Item "Interword Space|w" "next-inset-modify space \space{}" - Item "Protected Space|o" "next-inset-modify space ~" - Item "Thin Space|T" "next-inset-modify space \thinspace{}" - Item "Negative Thin Space|N" "next-inset-modify space \negthinspace{}" - Item "Half Quad Space (Enskip)|k" "next-inset-modify space \enskip{}" - Item "Protected Half Quad Space (Enspace)|E" "next-inset-modify space \enspace{}" - Item "Quad Space|Q" "next-inset-modify space \quad{}" - Item "Double Quad Space|u" "next-inset-modify space \qquad{}" - Item "Horizontal Fill|F" "next-inset-modify space \hfill{}" - Item "Protected Horizontal Fill|i" "next-inset-modify space \hspace*{\fill}" - Item "Horizontal Fill (Dots)|D" "next-inset-modify space \dotfill{}" - Item "Horizontal Fill (Rule)|R" "next-inset-modify space \hrulefill{}" - Item "Horizontal Fill (Left Arrow)|L" "next-inset-modify space \leftarrowfill{}" - 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; inset-settings" + Item "Interword Space|w" "inset-modify space \space{}" + Item "Protected Space|o" "inset-modify space ~" + Item "Thin Space|T" "inset-modify space \thinspace{}" + Item "Negative Thin Space|N" "inset-modify space \negthinspace{}" + Item "Half Quad Space (Enskip)|k" "inset-modify space \enskip{}" + Item "Protected Half Quad Space (Enspace)|E" "inset-modify space \enspace{}" + Item "Quad Space|Q" "inset-modify space \quad{}" + Item "Double Quad Space|u" "inset-modify space \qquad{}" + Item "Horizontal Fill|F" "inset-modify space \hfill{}" + Item "Protected Horizontal Fill|i" "inset-modify space \hspace*{\fill}" + Item "Horizontal Fill (Dots)|D" "inset-modify space \dotfill{}" + Item "Horizontal Fill (Rule)|R" "inset-modify space \hrulefill{}" + Item "Horizontal Fill (Left Arrow)|L" "inset-modify space \leftarrowfill{}" + Item "Horizontal Fill (Right Arrow)|g" "inset-modify space \rightarrowfill{}" + Item "Horizontal Fill (Up Brace)|p" "inset-modify space \upbracefill{}" + Item "Horizontal Fill (Down Brace)|B" "inset-modify space \downbracefill{}" + Item "Custom Length|C" "command-sequence inset-modify space \hspace{} \length 1in; inset-settings" Separator Item "Settings...|S" "inset-settings" End @@ -226,16 +226,16 @@ Menuset # InsetMathSpace context menu # Menu "context-mathspace" - Item "Thin Space|T" "next-inset-modify mathspace \thinspace{}" - Item "Medium Space|M" "next-inset-modify mathspace \medspace{}" - Item "Thick Space|h" "next-inset-modify mathspace \thickspace{}" - Item "Negative Thin Space|N" "next-inset-modify mathspace \negthinspace{}" - Item "Negative Medium Space|u" "next-inset-modify mathspace \negmedspace{}" - Item "Negative Thick Space|i" "next-inset-modify mathspace \negthickspace{}" - 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; inset-settings" + Item "Thin Space|T" "inset-modify mathspace \thinspace{}" + Item "Medium Space|M" "inset-modify mathspace \medspace{}" + Item "Thick Space|h" "inset-modify mathspace \thickspace{}" + Item "Negative Thin Space|N" "inset-modify mathspace \negthinspace{}" + Item "Negative Medium Space|u" "inset-modify mathspace \negmedspace{}" + Item "Negative Thick Space|i" "inset-modify mathspace \negthickspace{}" + Item "Half Quad Space (Enskip)|k" "inset-modify mathspace \enskip{}" + Item "Quad Space|Q" "inset-modify mathspace \quad{}" + Item "Double Quad Space|u" "inset-modify mathspace \qquad{}" + Item "Custom Length|C" "command-sequence inset-modify mathspace \hspace{} \length 1in; inset-settings" Separator Item "Settings...|S" "inset-settings" End @@ -244,12 +244,12 @@ Menuset # InsetVSpace context menu # Menu "context-vspace" - Item "DefSkip|D" "next-inset-modify vspace defskip" - Item "SmallSkip|S" "next-inset-modify vspace smallskip" - 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; inset-settings" + Item "DefSkip|D" "inset-modify vspace defskip" + Item "SmallSkip|S" "inset-modify vspace smallskip" + Item "MedSkip|M" "inset-modify vspace medskip" + Item "BigSkip|B" "inset-modify vspace bigskip" + Item "VFill|F" "inset-modify vspace vfill" + Item "Custom|C" "command-sequence inset-modify vspace 1in; inset-settings" Separator Item "Settings...|e" "inset-settings" End @@ -258,11 +258,11 @@ Menuset # InsetInclude context menu # Menu "context-include" - Item "Include|c" "next-inset-modify changetype include" - Item "Input|p" "next-inset-modify changetype input" - Item "Verbatim|V" "next-inset-modify changetype verbatiminput" - Item "Verbatim (marked blanks)|b" "next-inset-modify changetype verbatiminput*" - Item "Listing|L" "next-inset-modify changetype lstinputlisting" + Item "Include|c" "inset-modify changetype include" + Item "Input|p" "inset-modify changetype input" + Item "Verbatim|V" "inset-modify changetype verbatiminput" + Item "Verbatim (marked blanks)|b" "inset-modify changetype verbatiminput*" + Item "Listing|L" "inset-modify changetype lstinputlisting" Separator Item "Settings...|S" "inset-settings" Separator @@ -273,18 +273,18 @@ Menuset # InsetNewpage context menu # Menu "context-newpage" - Item "New Page|N" "next-inset-modify newpage newpage" - Item "Page Break|a" "next-inset-modify newpage pagebreak" - Item "Clear Page|C" "next-inset-modify newpage clearpage" - Item "Clear Double Page|D" "next-inset-modify newpage cleardoublepage" + Item "New Page|N" "inset-modify newpage newpage" + Item "Page Break|a" "inset-modify newpage pagebreak" + Item "Clear Page|C" "inset-modify newpage clearpage" + Item "Clear Double Page|D" "inset-modify newpage cleardoublepage" End # # InsetNewline context menu # Menu "context-newline" - Item "Ragged Line Break|R" "next-inset-modify newline newline" - Item "Justified Line Break|J" "next-inset-modify newline linebreak" + Item "Ragged Line Break|R" "inset-modify newline newline" + Item "Justified Line Break|J" "inset-modify newline linebreak" End # @@ -541,10 +541,10 @@ Menuset # Menu "context-indexprint" - Item "All Indexes|A" "next-inset-modify check-printindex*" + Item "All Indexes|A" "inset-modify check-printindex*" IndicesListsContext Separator - Item "Subindex|b" "next-inset-modify toggle-subindex" + Item "Subindex|b" "inset-modify toggle-subindex" Separator OptItem "Settings...|S" "inset-settings" End diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 2a00deff7d..24b44fd04f 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1039,18 +1039,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag) break; } - case LFUN_NEXT_INSET_MODIFY: { - // this is the real function we want to invoke - FuncRequest tmpcmd = cmd; - 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(); - if (!inset || !inset->getStatus(cur, tmpcmd, flag)) - flag = lyx::getStatus(tmpcmd); - break; - } - case LFUN_LABEL_GOTO: { flag.setEnabled(!cmd.argument().empty() || getInsetByCode(cur, REF_CODE)); @@ -1630,31 +1618,6 @@ bool BufferView::dispatch(FuncRequest const & cmd) break; } - case LFUN_NEXT_INSET_MODIFY: { - // create the the real function we want to invoke - FuncRequest tmpcmd = cmd; - tmpcmd.action = LFUN_INSET_MODIFY; - // if there is an inset at cursor, see whether it - // can be modified. - Inset * inset = cur.nextInset(); - if (inset) { - cur.recordUndo(); - inset->dispatch(cur, tmpcmd); - } - // if it did not work, try the underlying inset. - if (!inset || !cur.result().dispatched()) { - cur.recordUndo(); - cur.dispatch(tmpcmd); - } - - if (!cur.result().dispatched()) - // It did not work too; no action needed. - break; - cur.clearSelection(); - processUpdateFlags(Update::Force | Update::FitCursor); - break; - } - case LFUN_SCREEN_UP: case LFUN_SCREEN_DOWN: { Point p = getPos(cur, cur.boundary()); diff --git a/src/FuncCode.h b/src/FuncCode.h index 4f175ad9d6..12996600b8 100644 --- a/src/FuncCode.h +++ b/src/FuncCode.h @@ -205,7 +205,7 @@ enum FuncCode LFUN_PARAGRAPH_DOWN, // Asger 1996-10-01 // 145 LFUN_PARAGRAPH_DOWN_SELECT, // Asger 1996-10-01 - LFUN_NEXT_INSET_MODIFY, // JSpitzm 20080323 + LFUN_INSET_FORALL, // lasgouttes, 20091127 LFUN_BUFFER_NEW_TEMPLATE, // Asger 1997-02-02 LFUN_BUFFER_RELOAD, // Asger 1997-02-02 LFUN_RECONFIGURE, @@ -445,7 +445,6 @@ enum FuncCode LFUN_CURSOR_FOLLOWS_SCROLLBAR_TOGGLE, // ARRae 971202 // 345 LFUN_DEBUG_LEVEL_SET, - LFUN_INSET_FORALL, // lasgouttes, 20091127 LFUN_LASTACTION // end of the table }; diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index ce771f8ca1..df09c62374 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -2316,28 +2316,17 @@ void LyXAction::init() { LFUN_INSET_INSERT, "inset-insert", Noop, Edit }, /*! * \var lyx::FuncCode lyx::LFUN_INSET_MODIFY - * \li Action: Modify existing inset. + * \li Action: Modify some properties of an inset. * \li Notion: Used for bibitem, bibtex, box, branch, command, ert, external, - floats, graphics, include, label, listings, note, - phantom, ref, space, tabular, vspace, wrap insets. + floats, graphics, include, index, info, label, + listings, newline, newpage, nomencl, note, phantom, + ref, space, tabular, vspace, wrap insets. * \li Syntax: inset-modify + * \li Syntax: inset-modify changetype * \li Params: See #LFUN_INSET_INSERT for further details. * \endvar */ - { LFUN_INSET_MODIFY, "", Noop, Hidden }, -/*! - * \var lyx::FuncCode lyx::LFUN_NEXT_INSET_MODIFY - * \li Action: Modify the inset at cursor position, if there is one. - * \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-modify - * \li Syntax: next-inset-modify changetype - * \li Params: See #LFUN_INSET_INSERT for further details. - * \li Origin: JSpitzm, 23 Mar 2008 - * \endvar - */ - { LFUN_NEXT_INSET_MODIFY, "next-inset-modify", Noop, Edit }, + { LFUN_INSET_MODIFY, "inset-modify", AtPoint, Edit }, /*! * \var lyx::FuncCode lyx::LFUN_INSET_DIALOG_UPDATE * \li Action: Updates the values inside the dialog from the inset. diff --git a/src/frontends/qt4/GuiInfo.cpp b/src/frontends/qt4/GuiInfo.cpp index 48267ed228..9d162835c4 100644 --- a/src/frontends/qt4/GuiInfo.cpp +++ b/src/frontends/qt4/GuiInfo.cpp @@ -96,7 +96,7 @@ void GuiInfo::applyView() if (!ii->validate(argument)) return; - dispatch(FuncRequest(LFUN_NEXT_INSET_MODIFY, argument)); + dispatch(FuncRequest(LFUN_INSET_MODIFY, argument)); // FIXME: update the inset contents bufferview()->buffer().updateLabels(); BufferView * bv = const_cast(bufferview()); diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index c916fb8bf6..80b3fbeb61 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -1271,12 +1271,12 @@ void MenuDefinition::expandIndicesContext(Buffer const * buf, bool listof) p["type"] = cit->shortcut(); string const data = InsetCommand::params2string("index_print", p); addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(cit->index()), - FuncRequest(LFUN_NEXT_INSET_MODIFY, data))); + FuncRequest(LFUN_INSET_MODIFY, data))); } else { docstring label = _("Index Entry"); label += " (" + cit->index() + ")"; addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label), - FuncRequest(LFUN_NEXT_INSET_MODIFY, + FuncRequest(LFUN_INSET_MODIFY, from_ascii("changetype ") + cit->shortcut()))); } } @@ -1317,7 +1317,7 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv) CiteStyle cst = citeStyleList[ii - 1]; cs.style = cst; addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label), - FuncRequest(LFUN_NEXT_INSET_MODIFY, + FuncRequest(LFUN_INSET_MODIFY, "changetype " + from_utf8(citationStyleToString(cs))))); } } -- 2.39.2