diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bad8a6ba80..713f64dce1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -119,6 +119,8 @@ The following LyX functions have been removed: - LFUN_LINE_INSERT ("line-insert"): use "inset-insert line" instead. +- LFUN_TOC_INSERT ("toc-insert"): use "inset-insert toc" instead. + The following LyX functions have been changed: diff --git a/lib/ui/stdmenus.inc b/lib/ui/stdmenus.inc index 31b7a33ad8..bbe64258af 100644 --- a/lib/ui/stdmenus.inc +++ b/lib/ui/stdmenus.inc @@ -436,7 +436,7 @@ Menuset End Menu "insert_toc" - Item "Table of Contents|C" "toc-insert" + Item "Table of Contents|C" "inset-insert toc" FloatListInsert IndicesLists Item "Nomenclature|N" "nomencl-print" diff --git a/src/FuncCode.h b/src/FuncCode.h index e74abf5e9d..746d88c424 100644 --- a/src/FuncCode.h +++ b/src/FuncCode.h @@ -216,7 +216,7 @@ enum FuncCode LFUN_CELL_SPLIT, LFUN_BUFFER_CHILD_OPEN, // Ale 970528 // 155 - LFUN_TOC_INSERT, // Lgb 97-05-27 + LFUN_INSET_COPY_AS, // vfr, 20100419 LFUN_FLOAT_LIST_INSERT, // Lgb 20010503 LFUN_BUFFER_TOGGLE_READ_ONLY, // Lgb 97-05-27 LFUN_VC_REGISTER, // Lgb 97-07-01 @@ -447,7 +447,6 @@ enum FuncCode LFUN_SPELLING_REMOVE, // switt 20100728 LFUN_PREVIEW_INSERT, // vfr, 20100328 LFUN_FORWARD_SEARCH, - LFUN_INSET_COPY_AS, // vfr, 20100419 LFUN_LASTACTION // end of the table }; diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index c7f5b8ea40..6b66c4fb58 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -506,14 +506,6 @@ void LyXAction::init() * \endvar */ { LFUN_SPECIALCHAR_INSERT, "specialchar-insert", Noop, Edit }, -/*! - * \var lyx::FuncCode lyx::LFUN_TOC_INSERT - * \li Action: Inserts table of contents. - * \li Syntax: toc-insert - * \li Origin: Lgb, 27 May 97 - * \endvar - */ - { LFUN_TOC_INSERT, "toc-insert", Noop, Edit }, /*! * \var lyx::FuncCode lyx::LFUN_APPENDIX * \li Action: Start (or remove) Appendix on the given cursor position. diff --git a/src/Text3.cpp b/src/Text3.cpp index ea770e519c..08049f0053 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1671,7 +1671,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) } case LFUN_NOMENCL_PRINT: - case LFUN_TOC_INSERT: case LFUN_NEWPAGE_INSERT: // do nothing fancy doInsertInset(cur, this, cmd, false, false); @@ -2391,11 +2390,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, // not allowed in description items enable = !inDescriptionItem(cur); break; - case LFUN_TOC_INSERT: - code = TOC_CODE; - // not allowed in description items - enable = !inDescriptionItem(cur); - break; case LFUN_HYPERLINK_INSERT: if (cur.selIsMultiCell() || cur.selIsMultiLine()) { enable = false; @@ -2697,7 +2691,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_LINE_END: case LFUN_CHAR_DELETE_FORWARD: case LFUN_CHAR_DELETE_BACKWARD: - case LFUN_INSET_INSERT: case LFUN_WORD_UPCASE: case LFUN_WORD_LOWCASE: case LFUN_WORD_CAPITALIZE: @@ -2713,6 +2706,19 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, enable = true; break; + case LFUN_INSET_INSERT: { + string const type = cmd.getArg(0); + if (type == "toc") { + code = TOC_CODE; + // not allowed in description items + //FIXME: couldn't this be merged in Inset::insetAllowed()? + enable = !inDescriptionItem(cur); + } else { + enable = true; + } + break; + } + default: return false; } diff --git a/src/factory.cpp b/src/factory.cpp index a1a375f9b5..7fa0c55dce 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -200,9 +200,6 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd) return new InsetPrintNomencl(buf, icp); } - case LFUN_TOC_INSERT: - return new InsetTOC(buf, InsetCommandParams(TOC_CODE)); - case LFUN_INFO_INSERT: { InsetInfo * inset = new InsetInfo(buf, to_utf8(cmd.argument())); inset->updateInfo(); diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp index b53f08958c..065bd383e5 100644 --- a/src/insets/InsetCommand.cpp +++ b/src/insets/InsetCommand.cpp @@ -229,6 +229,11 @@ bool InsetCommand::string2params(string const & name, string const & in, params.clear(); if (in.empty()) return false; + // This happens when inset-insert is called without argument except for the + // inset type; ex: + // "inset-insert toc" + if (in == name) + return true; istringstream data(in); Lexer lex; lex.setStream(data);