- // the functions which insert insets
- InsetOld::Code code = InsetOld::NO_CODE;
- switch (ev.action) {
- case LFUN_DIALOG_SHOW_NEW_INSET:
- if (ev.argument == "bibitem")
- code = InsetOld::BIBITEM_CODE;
- else if (ev.argument == "bibtex")
- code = InsetOld::BIBTEX_CODE;
- else if (ev.argument == "box")
- code = InsetOld::BOX_CODE;
- else if (ev.argument == "branch")
- code = InsetOld::BRANCH_CODE;
- else if (ev.argument == "citation")
- code = InsetOld::CITE_CODE;
- else if (ev.argument == "ert")
- code = InsetOld::ERT_CODE;
- else if (ev.argument == "external")
- code = InsetOld::EXTERNAL_CODE;
- else if (ev.argument == "float")
- code = InsetOld::FLOAT_CODE;
- else if (ev.argument == "graphics")
- code = InsetOld::GRAPHICS_CODE;
- else if (ev.argument == "include")
- code = InsetOld::INCLUDE_CODE;
- else if (ev.argument == "index")
- code = InsetOld::INDEX_CODE;
- else if (ev.argument == "label")
- code = InsetOld::LABEL_CODE;
- else if (ev.argument == "minipage")
- code = InsetOld::MINIPAGE_CODE;
- else if (ev.argument == "note")
- code = InsetOld::NOTE_CODE;
- else if (ev.argument == "ref")
- code = InsetOld::REF_CODE;
- else if (ev.argument == "toc")
- code = InsetOld::TOC_CODE;
- else if (ev.argument == "url")
- code = InsetOld::URL_CODE;
- else if (ev.argument == "vspace")
- code = InsetOld::VSPACE_CODE;
- else if (ev.argument == "wrap")
- code = InsetOld::WRAP_CODE;
- break;
-
- case LFUN_INSET_ERT:
- code = InsetOld::ERT_CODE;
- break;
- case LFUN_INSET_FOOTNOTE:
- code = InsetOld::FOOT_CODE;
- break;
- case LFUN_TABULAR_INSERT:
- code = InsetOld::TABULAR_CODE;
- break;
- case LFUN_INSET_MARGINAL:
- code = InsetOld::MARGIN_CODE;
- break;
- case LFUN_INSET_MINIPAGE:
- code = InsetOld::MINIPAGE_CODE;
- break;
- case LFUN_INSET_FLOAT:
- case LFUN_INSET_WIDE_FLOAT:
- code = InsetOld::FLOAT_CODE;
- break;
- case LFUN_INSET_WRAP:
- code = InsetOld::WRAP_CODE;
- break;
- case LFUN_FLOAT_LIST:
- code = InsetOld::FLOAT_LIST_CODE;
- break;
-#if 0
- case LFUN_INSET_LIST:
- code = InsetOld::LIST_CODE;
- break;
- case LFUN_INSET_THEOREM:
- code = InsetOld::THEOREM_CODE;
- break;
-#endif
- case LFUN_INSET_CAPTION:
- code = InsetOld::CAPTION_CODE;
- break;
- case LFUN_INSERT_NOTE:
- code = InsetOld::NOTE_CODE;
- break;
- case LFUN_INSERT_CHARSTYLE:
- code = InsetOld::CHARSTYLE_CODE;
- if (buf->params().getLyXTextClass().charstyles().empty())
- disable = true;
- break;
- case LFUN_INSERT_BOX:
- code = InsetOld::BOX_CODE;
- break;
- case LFUN_INSERT_BRANCH:
- code = InsetOld::BRANCH_CODE;
- if (buf->params().branchlist().empty())
- disable = true;
- break;
- case LFUN_INSERT_LABEL:
- code = InsetOld::LABEL_CODE;
- break;
- case LFUN_INSET_OPTARG:
- code = InsetOld::OPTARG_CODE;
- break;
- case LFUN_ENVIRONMENT_INSERT:
- code = InsetOld::MINIPAGE_CODE;
- break;
- case LFUN_INDEX_INSERT:
- code = InsetOld::INDEX_CODE;
- break;
- case LFUN_INDEX_PRINT:
- code = InsetOld::INDEX_PRINT_CODE;
- break;
- case LFUN_TOC_INSERT:
- code = InsetOld::TOC_CODE;
- break;
- case LFUN_HTMLURL:
- case LFUN_URL:
- code = InsetOld::URL_CODE;
- break;
- case LFUN_QUOTE:
- // always allow this, since we will inset a raw quote
- // if an inset is not allowed.
- break;
- case LFUN_HYPHENATION:
- case LFUN_LIGATURE_BREAK:
- case LFUN_HFILL:
- case LFUN_MENU_SEPARATOR:
- case LFUN_LDOTS:
- case LFUN_END_OF_SENTENCE:
- code = InsetOld::SPECIALCHAR_CODE;
- break;
- case LFUN_SPACE_INSERT:
- // slight hack: we know this is allowed in math mode
- if (!mathcursor)
- code = InsetOld::SPACE_CODE;
- break;
- case LFUN_INSET_DIALOG_SHOW: {
- InsetOld * inset = view()->getLyXText()->getInset();
- disable = !inset;
- if (!disable) {
- code = inset->lyxCode();
- if (!(code == InsetOld::INCLUDE_CODE
- || code == InsetOld::BIBTEX_CODE
- || code == InsetOld::FLOAT_LIST_CODE
- || code == InsetOld::TOC_CODE))
- disable = true;
- }
- break;
- }
- default:
- break;