* Get rid of LFUN_TOC_INSERT: we use LFUN_INSET_INSERT "toc".

* Fix usage of "inset-insert type" without CommandInset arguments.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35345 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2010-09-12 07:56:08 +00:00
parent a648c39b70
commit d8981b13ae
7 changed files with 22 additions and 21 deletions

View File

@ -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:

View File

@ -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"

View File

@ -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
};

View File

@ -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.

View File

@ -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;
}

View File

@ -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();

View File

@ -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);