]> git.lyx.org Git - lyx.git/commitdiff
* Get rid of LFUN_TOC_INSERT: we use LFUN_INSET_INSERT "toc".
authorAbdelrazak Younes <younes@lyx.org>
Sun, 12 Sep 2010 07:56:08 +0000 (07:56 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 12 Sep 2010 07:56:08 +0000 (07:56 +0000)
* 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

RELEASE-NOTES
lib/ui/stdmenus.inc
src/FuncCode.h
src/LyXAction.cpp
src/Text3.cpp
src/factory.cpp
src/insets/InsetCommand.cpp

index bad8a6ba805085dab21629c51c35f04a6895c70a..713f64dce12b2aab8f7c77436ba770792d1d90ee 100644 (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:
 
index 31b7a33ad843f565dd3352f2b733cfd382b9e2d9..bbe64258afd228e499a810784cd2df17d7efd63d 100644 (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"
index e74abf5e9df368ec554ba76a1315428b46c90b52..746d88c424066fd4473b5cdddee0749fdcdcaa21 100644 (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
 };
index c7f5b8ea401680d06f3b549bfad5bfc696e70cf6..6b66c4fb583628a689cb2a05a544dd8e6df081ac 100644 (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.
index ea770e519cb3aa6f7758166758a7b3d474737ecb..08049f005382689ec374c9291df51a022b5a7560 100644 (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;
        }
index a1a375f9b56004a637afe1ffa56baca9dcc3865c..7fa0c55dce7f0b1751012bdc4dc9a3e86c44bdf5 100644 (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();
index b53f08958c76cb83cd2671f86d968eabc95ea755..065bd383e5f81eea455be6625c51a76547b96357 100644 (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);