]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Add known citation packages to LaTeXFeatures:
[lyx.git] / src / Text3.cpp
index 22f4b9922d3321fb6c0ab9cb5e22740c79eb017c..bfb392c63e2227ba34f276b3f44c9885c51b9aac 100644 (file)
@@ -1374,10 +1374,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                if (change_layout)
                        setLayout(cur, layout);
 
-               Layout::LaTeXArgMap args = tclass[layout].latexargs();
-               Layout::LaTeXArgMap itemargs = tclass[layout].itemargs();
-               if (!itemargs.empty())
-                       args.insert(itemargs.begin(), itemargs.end());
+               Layout::LaTeXArgMap args = tclass[layout].args();
                Layout::LaTeXArgMap::const_iterator lait = args.begin();
                Layout::LaTeXArgMap::const_iterator const laend = args.end();
                for (; lait != laend; ++lait) {
@@ -1391,6 +1388,21 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                break;
        }
 
+       case LFUN_ENVIRONMENT_SPLIT: {
+               Paragraph const & para = cur.paragraph();
+               docstring const layout = para.layout().name();
+               if (cur.pos() > 0)
+                       lyx::dispatch(FuncRequest(LFUN_PARAGRAPH_BREAK));
+               bool const morecont = cur.lastpos() > cur.pos();
+               lyx::dispatch(FuncRequest(LFUN_LAYOUT, "Separator"));
+               lyx::dispatch(FuncRequest(LFUN_PARAGRAPH_BREAK, "inverse"));
+               if (morecont) 
+                       lyx::dispatch(FuncRequest(LFUN_DOWN));
+               lyx::dispatch(FuncRequest(LFUN_LAYOUT, layout));
+
+               break;
+       }
+
        case LFUN_CLIPBOARD_PASTE:
                cap::replaceSelection(cur);
                pasteClipboardText(cur, bv->buffer().errorList("Paste"),
@@ -2516,11 +2528,21 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                }
                break;
        }
-       case LFUN_CAPTION_INSERT:
+       case LFUN_CAPTION_INSERT: {
                code = CAPTION_CODE;
-               // not allowed in description items
-               enable = !inDescriptionItem(cur);
+               bool varia = true;
+               if (cur.depth() > 0) {
+                       if (&cur[cur.depth() - 1].inset()
+                           && !cur[cur.depth() - 1].inset().allowsCaptionVariation())
+                               varia = false;
+               }
+               string arg = cmd.getArg(0);
+               // not allowed in description items,
+               // and in specific insets
+               enable = !inDescriptionItem(cur)
+                       && (varia || arg.empty() || arg == "Standard");
                break;
+       }
        case LFUN_NOTE_INSERT:
                code = NOTE_CODE;
                // in commands (sections etc.) and description items,
@@ -2571,10 +2593,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                        break;
                }
                Layout const & lay = cur.paragraph().layout();
-               Layout::LaTeXArgMap args = lay.latexargs();
-               Layout::LaTeXArgMap itemargs = lay.itemargs();
-               if (!itemargs.empty())
-                       args.insert(itemargs.begin(), itemargs.end());
+               Layout::LaTeXArgMap args = lay.args();
                Layout::LaTeXArgMap::const_iterator const lait =
                                args.find(arg);
                if (lait != args.end()) {
@@ -2869,7 +2888,17 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_LAYOUT:
                enable = !cur.inset().forcePlainLayout();
                break;
-               
+       
+       case LFUN_ENVIRONMENT_SPLIT: {
+               if (cur.paragraph().layout().isEnvironment()
+                   && cur.buffer()->params().documentClass().hasLayout(from_ascii("Separator"))) {
+                       enable = true;
+                       break;
+               }
+               enable = false;
+               break;
+       }
+
        case LFUN_LAYOUT_PARAGRAPH:
        case LFUN_PARAGRAPH_PARAMS:
        case LFUN_PARAGRAPH_PARAMS_APPLY: