[LyX/master] Add support InsetLayout LaTeXType simplecommand (#4066)

Juergen Spitzmueller spitz at lyx.org
Thu Feb 19 08:11:41 UTC 2026


commit ae9178314382df799da2746af232d11e3e56a11e
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Thu Feb 19 09:10:18 2026 +0100

    Add support InsetLayout LaTeXType simplecommand (#4066)
    
    This allows custom insets without mandatory argument
---
 lib/doc/Customization.lyx       | 104 ++++++++++++++++-
 lib/doc/de/Customization.lyx    |  65 +++++++++++
 lib/scripts/layout2layout.py    |   7 +-
 src/Makefile.am                 |   2 +
 src/Text.cpp                    |   6 +-
 src/TextClass.cpp               |   2 +-
 src/insets/InsetArgument.cpp    |  22 ++++
 src/insets/InsetCollapsible.h   |   4 +-
 src/insets/InsetDynamicArgs.cpp | 248 ++++++++++++++++++++++++++++++++++++++++
 src/insets/InsetDynamicArgs.h   |  64 +++++++++++
 src/insets/InsetFlex.cpp        |  21 ++--
 src/insets/InsetFlex.h          |   4 +-
 src/insets/InsetLayout.cpp      |   2 +
 src/insets/InsetLayout.h        |   1 +
 14 files changed, 535 insertions(+), 17 deletions(-)

diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx
index b36cc59af5..0ed91fd900 100644
--- a/lib/doc/Customization.lyx
+++ b/lib/doc/Customization.lyx
@@ -21635,7 +21635,12 @@ status collapsed
 \begin_layout Plain Layout
 Command,
  Environment,
- None
+ 
+\change_inserted -712698321 1771319126
+SimpleCommand,
+ 
+\change_unchanged
+None
 \end_layout
 
 \end_inset
@@ -21707,6 +21712,62 @@ LatexName
 \end_inset
 
 
+\change_inserted -712698321 1771319160
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted -712698321 1771319925
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1771319164
+SimpleCommand
+\end_layout
+
+\end_inset
+
+ is a command without a mandatory argument,
+ as in 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1771319160
+
+\backslash
+
+\emph on
+LatexName
+\end_layout
+
+\end_inset
+
+.
+ The command might get arguments defined via 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1771319266
+Argument
+\end_layout
+
+\end_inset
+
+.
+ If so,
+ they can be inserted into the collapsible inset,
+ which only allows argument insets.
+ If no arguments are defined,
+ the inset is a simple button and cannot be uncollapsed.
+\change_unchanged
+
 \end_layout
 
 \begin_layout Description
@@ -21758,6 +21819,22 @@ LatexName[LatexParam]{\SpecialChar ldots
 }
 \end_layout
 
+\begin_layout Standard
+
+\change_inserted -712698321 1771319490
+or:
+\end_layout
+
+\begin_layout LyX-Code
+
+\change_inserted -712698321 1771319490
+
+\backslash
+LatexName[LatexParam]
+\change_unchanged
+
+\end_layout
+
 \begin_layout Standard
 or:
 \end_layout
@@ -21774,6 +21851,25 @@ end{LatexName}
 \begin_layout Standard
 depending upon the \SpecialChar LaTeX
  type.
+
+\change_inserted -712698321 1771320078
+ Instead of 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1771319567
+[LatexParam]
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+ there might be one or multiple optional or mandatory arguments as well (or nothing at all).
+\change_unchanged
+
 \end_layout
 
 \end_deeper
@@ -24604,6 +24700,8 @@ status collapsed
 
 \change_inserted -712698321 1763989442
 IgnoreLanguage
+\change_unchanged
+
 \end_layout
 
 \end_inset
@@ -24618,6 +24716,8 @@ status collapsed
 
 \emph on
 0
+\change_unchanged
+
 \end_layout
 
 \end_inset
@@ -24634,6 +24734,8 @@ status collapsed
 
 \change_inserted -712698321 1763989432
 1
+\change_unchanged
+
 \end_layout
 
 \end_inset
diff --git a/lib/doc/de/Customization.lyx b/lib/doc/de/Customization.lyx
index 67c26a2ee4..0ba8d09267 100644
--- a/lib/doc/de/Customization.lyx
+++ b/lib/doc/de/Customization.lyx
@@ -20519,6 +20519,50 @@ LatexName
 \begin_inset Flex Code
 status collapsed
 
+\begin_layout Plain Layout
+SimpleCommand
+\end_layout
+
+\end_inset
+
+ ist ein Befehl ohne obligatorisches Argument,
+ bspw.
+ 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\backslash
+
+\emph on
+LatexName
+\end_layout
+
+\end_inset
+
+.
+ Man kann für den Befehl Argumente mittels 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+Argument
+\end_layout
+
+\end_inset
+
+ definieren.
+ Falls dies der Fall ist,
+ können diese in die aufklappbare Einfügung eingefügt werden (andere Inhalte sind dort nicht zugelassen).
+ Falls keine Argumente definiert wurden,
+ kann die Einfügung gar nicht aufgeklappt werden.
+\end_layout
+
+\begin_layout Description
+\begin_inset Flex Code
+status collapsed
+
 \begin_layout Plain Layout
 Environment
 \end_layout
@@ -20565,6 +20609,16 @@ LatexName[LatexParam]{\SpecialChar ldots
 }
 \end_layout
 
+\begin_layout Standard
+oder:
+\end_layout
+
+\begin_layout LyX-Code
+
+\backslash
+LatexName[LatexParam]
+\end_layout
+
 \begin_layout Standard
 oder:
  
@@ -20583,6 +20637,17 @@ end{LatexName}
 sein wird,
  je nach \SpecialChar LaTeX
 -Typ.
+ Anstelle von 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+[LatexParam]
+\end_layout
+
+\end_inset
+
+ können auch ein oder mehrere optionale oder obligatorische Argumente (oder nichts) stehen.
 \end_layout
 
 \end_deeper
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index bb908a65d9..d5f2b48361 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -9,7 +9,7 @@
 # This script will update a .layout file to current format
 
 # The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 114
+currentFormat = 115
 
 
 # Incremented to format 4, 6 April 2007, lasgouttes
@@ -388,6 +388,9 @@ currentFormat = 114
 # Incremented to format 114, 27 October 2025 by spitz
 # New textclass tag SpecialChar
 
+# Incremented to format 115, 28 February 2026 by spitz
+# New InsetLayout option LaTeXType SimpleCommand
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -727,7 +730,7 @@ def convert(lines, end_format):
                 i += 1
             continue
 
-        if 101 <= format <= 114:
+        if 101 <= format <= 115:
             # nothing to do.
             i += 1
             continue
diff --git a/src/Makefile.am b/src/Makefile.am
index b61b0f8220..366c126824 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -562,6 +562,8 @@ liblyxinsets_a_SOURCES = \
 	insets/InsetCommandParams.h \
 	insets/InsetCounter.cpp \
 	insets/InsetCounter.h \
+	insets/InsetDynamicArgs.cpp \
+	insets/InsetDynamicArgs.h \
 	insets/InsetERT.cpp \
 	insets/InsetERT.h \
 	insets/InsetExternal.cpp \
diff --git a/src/Text.cpp b/src/Text.cpp
index 99ff2b8d92..3bafb753f1 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -3580,8 +3580,12 @@ bool doInsertInset(Cursor & cur, Text * text,
 	if (!inset)
 		return false;
 
-	if (InsetCollapsible * ci = inset->asInsetCollapsible())
+	if (InsetCollapsible * ci = inset->asInsetCollapsible()) {
 		ci->setButtonLabel();
+		// do not paste into SimpleCommand collapsibles
+		pastesel &= inset->getLayout().latextype()
+				!= InsetLaTeXType::SIMPLE_COMMAND;
+	}
 
 	cur.recordUndoSelection();
 	if (cmd.action() == LFUN_ARGUMENT_INSERT) {
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 7462af8245..5a52ae4145 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -59,7 +59,7 @@ namespace lyx {
 // You should also run the development/tools/updatelayouts.py script,
 // to update the format of all of our layout files.
 //
-int const LAYOUT_FORMAT = 114; // spitz: SpecialChar
+int const LAYOUT_FORMAT = 115; // spitz: LaTeXType SimpleCommand
 
 
 // Layout format for the current lyx file format. Controls which format is
diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp
index 8344b2c909..7556490251 100644
--- a/src/insets/InsetArgument.cpp
+++ b/src/insets/InsetArgument.cpp
@@ -246,6 +246,28 @@ bool InsetArgument::getStatus(Cursor & cur, FuncRequest const & cmd,
 		flag.setEnabled(false);
 		return true;
 
+	// We do not allow dissolving in SimpleCommand insets
+	case LFUN_CHAR_DELETE_FORWARD:
+		if (cur.pit() != cur.lastpit() || cur.pos() != cur.lastpos())
+			return InsetCollapsible::getStatus(cur, cmd, flag);
+	// fall through
+	case LFUN_CHAR_DELETE_BACKWARD:
+		if (cmd.action() == LFUN_CHAR_DELETE_BACKWARD
+		     && (cur.pit() != 0 || cur.pos() != 0))
+			return InsetCollapsible::getStatus(cur, cmd, flag);
+	// fall through
+	case LFUN_INSET_DISSOLVE: {
+		if (!cur.paragraph().layout().latexargs().empty())
+			return InsetCollapsible::getStatus(cur, cmd, flag);
+		Inset * in = cur.innerInsetOfType(FLEX_CODE);
+		if (in && in->getLayout().latextype() == InsetLaTeXType::SIMPLE_COMMAND) {
+			// do not allow in SimpleCommand insets
+			flag.setEnabled(false);
+			return true;
+		}
+		return InsetCollapsible::getStatus(cur, cmd, flag);
+	}
+
 	case LFUN_INSET_MODIFY: {
 		string const first_arg = cmd.getArg(0);
 		if (first_arg == "changetype") {
diff --git a/src/insets/InsetCollapsible.h b/src/insets/InsetCollapsible.h
index 695e05472f..5dfd1bc627 100644
--- a/src/insets/InsetCollapsible.h
+++ b/src/insets/InsetCollapsible.h
@@ -162,6 +162,8 @@ public:
 	///
 	void addToToc(DocIterator const & dit, bool output_active,
 	              UpdateType utype, TocBackend & backend) const override;
+	///
+	Dimension dimensionCollapsed(BufferView const & bv) const;
 
 protected:
 	///
@@ -177,8 +179,6 @@ protected:
 	std::unique_ptr<support::TempFile> tempfile_;
 
 private:
-	///
-	Dimension dimensionCollapsed(BufferView const & bv) const;
 	///
 	docstring labelstring_;
 
diff --git a/src/insets/InsetDynamicArgs.cpp b/src/insets/InsetDynamicArgs.cpp
new file mode 100644
index 0000000000..08f826f473
--- /dev/null
+++ b/src/insets/InsetDynamicArgs.cpp
@@ -0,0 +1,248 @@
+/**
+ * \file InsetDynamicArgs.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Jürgen Spitzmüller
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "InsetDynamicArgs.h"
+
+#include "Buffer.h"
+#include "BufferParams.h"
+#include "BufferView.h"
+#include "FuncRequest.h"
+#include "FuncStatus.h"
+#include "MetricsInfo.h"
+
+#include "frontends/Painter.h"
+
+using namespace std;
+
+namespace lyx {
+
+
+InsetDynamicArgs::InsetDynamicArgs(Buffer * buf)
+	: InsetCollapsible(buf)
+{}
+
+
+InsetDynamicArgs::InsetDynamicArgs(InsetDynamicArgs const & in)
+	: InsetCollapsible(in)
+{}
+
+
+bool InsetDynamicArgs::isButtonOnly() const
+{
+	InsetLayout const & il = getLayout();
+	return (il.latextype() == InsetLaTeXType::SIMPLE_COMMAND
+	        && (il.latexargs().empty() && il.postcommandargs().empty()));
+}
+
+
+void InsetDynamicArgs::draw(PainterInfo & pi, int x, int y) const
+{
+	if (!isButtonOnly()) {
+		InsetCollapsible::draw(pi, x, y);
+		return;
+	}
+
+	BufferView const & bv = *pi.base.bv;
+	Changer dummy = pi.base.font.change(getFont(), true);
+	// Draw button
+	Dimension dimc = dimensionCollapsed(bv);
+
+	FontInfo labelfont = getLabelfont();
+	labelfont.setColor(labelColor());
+	labelfont.realize(pi.base.font);
+	pi.pain.buttonText(x, y, buttonLabel(bv), labelfont,
+			   Color_commandbg, Color_commandframe, Inset::textOffset(pi.base.bv));
+	// Draw the change tracking cue on the label, unless RowPainter already
+	// takes care of it.
+	if (canPaintChange(bv))
+		pi.change.paintCue(pi, x, y, x + dimc.width(), labelfont);
+}
+
+
+void InsetDynamicArgs::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+	if (!isButtonOnly()) {
+		InsetCollapsible::metrics(mi, dim);
+		return;
+	}
+
+	BufferView const & bv = *mi.base.bv;
+	dim = dimensionCollapsed(bv);
+}
+
+
+bool InsetDynamicArgs::getStatus(Cursor & cur, FuncRequest const & cmd,
+		FuncStatus & flag) const
+{
+	if (getLayout().latextype() == InsetLaTeXType::SIMPLE_COMMAND) {
+		switch (cmd.action()) {
+		// we only allow these for SimpleCommand
+		case LFUN_ARGUMENT_INSERT:
+		case LFUN_UNDO:
+		case LFUN_REDO:
+		case LFUN_CUT:
+		case LFUN_WORD_DELETE_FORWARD:
+		case LFUN_WORD_DELETE_BACKWARD:
+		case LFUN_LINE_DELETE_FORWARD:
+		case LFUN_WORD_FORWARD:
+		case LFUN_WORD_BACKWARD:
+		case LFUN_WORD_RIGHT:
+		case LFUN_WORD_LEFT:
+		case LFUN_CHAR_FORWARD:
+		case LFUN_CHAR_FORWARD_SELECT:
+		case LFUN_CHAR_BACKWARD:
+		case LFUN_CHAR_BACKWARD_SELECT:
+		case LFUN_CHAR_LEFT:
+		case LFUN_CHAR_LEFT_SELECT:
+		case LFUN_CHAR_RIGHT:
+		case LFUN_CHAR_RIGHT_SELECT:
+		case LFUN_UP:
+		case LFUN_UP_SELECT:
+		case LFUN_DOWN:
+		case LFUN_PARAGRAPH_SELECT:
+		case LFUN_LINE_BEGIN_SELECT:
+		case LFUN_LINE_END_SELECT:
+		case LFUN_WORD_FORWARD_SELECT:
+		case LFUN_WORD_BACKWARD_SELECT:
+		case LFUN_WORD_RIGHT_SELECT:
+		case LFUN_WORD_LEFT_SELECT:
+		case LFUN_WORD_SELECT:
+		case LFUN_SECTION_SELECT:
+		case LFUN_BUFFER_BEGIN:
+		case LFUN_BUFFER_END:
+		case LFUN_BUFFER_BEGIN_SELECT:
+		case LFUN_BUFFER_END_SELECT:
+		case LFUN_INSET_BEGIN:
+		case LFUN_INSET_END:
+		case LFUN_INSET_BEGIN_SELECT:
+		case LFUN_INSET_END_SELECT:
+		case LFUN_PARAGRAPH_UP:
+		case LFUN_PARAGRAPH_DOWN:
+		case LFUN_LINE_BEGIN:
+		case LFUN_LINE_END:
+		case LFUN_CHAR_DELETE_FORWARD:
+		case LFUN_CHAR_DELETE_BACKWARD:
+		case LFUN_SERVER_GET_XY:
+		case LFUN_SERVER_SET_XY:
+		case LFUN_SERVER_GET_LAYOUT:
+		case LFUN_ESCAPE:
+		case LFUN_SERVER_GET_STATISTICS:
+			return InsetText::getStatus(cur, cmd, flag);
+
+		case LFUN_INSET_DISSOLVE: {
+			if (isButtonOnly()) {
+				flag.setEnabled(false);
+				return true;
+			}
+			return InsetText::getStatus(cur, cmd, flag);
+		}
+
+		default:
+			flag.setEnabled(false);
+			return true;
+		}
+	}
+
+	return InsetCollapsible::getStatus(cur, cmd, flag);
+}
+
+
+InsetCollapsible::Geometry InsetDynamicArgs::geometry(BufferView const & bv) const
+{
+	if (isButtonOnly())
+		return ButtonOnly;
+
+	return InsetCollapsible::geometry(bv);
+}
+
+
+bool InsetDynamicArgs::editable() const
+{
+	if (isButtonOnly())
+		return false;
+	
+	return InsetCollapsible::editable();
+}
+
+
+bool InsetDynamicArgs::descendable(BufferView const & bv) const
+{
+	if (isButtonOnly())
+		return false;
+	
+	return InsetCollapsible::descendable(bv);
+}
+
+
+bool InsetDynamicArgs::clickable(BufferView const & bv, int x, int y) const
+{
+	if (isButtonOnly())
+		return false;
+
+	return InsetCollapsible::clickable(bv, x, y);
+}
+
+
+void InsetDynamicArgs::latex(otexstream & os, OutputParams const & runparams) const
+{
+	InsetLayout const & il = getLayout();
+	if (il.latextype() != InsetLaTeXType::SIMPLE_COMMAND)
+		// non-SimpleCommand collapsibles are
+		// dealt with in InsetText
+		return InsetCollapsible::latex(os, runparams);
+
+	// SimpleCommand insets: They don't have a mandatory argument
+	// from InsetText, but they might have InsetArguments
+	if (il.forceOwnlines())
+		os << breakln;
+
+	if (!il.latexname().empty()) {
+		// FIXME UNICODE
+		// FIXME \protect should only be used for fragile
+		//    commands, but we do not provide this information yet.
+		if (runparams.moving_arg)
+			os << "\\protect";
+		os << '\\' << from_utf8(il.latexname());
+		if (!il.latexargs().empty())
+			getArgs(os, runparams);
+		if (!il.latexparam().empty())
+			os << from_utf8(il.latexparam());
+	} else {
+		if (!il.latexargs().empty())
+			getArgs(os, runparams);
+		if (!il.latexparam().empty())
+			os << from_utf8(il.latexparam());
+	}
+
+	if (!il.latexname().empty()) {
+		if (!il.postcommandargs().empty())
+			getArgs(os, runparams, true);
+	}
+
+	if (il.forceOwnlines())
+		os << breakln;
+	else if (os.lastChar() != '}' && os.lastChar() != ']')
+		// properly terminate command
+		os << termcmd;
+}
+
+
+string InsetDynamicArgs::contextMenu(BufferView const & bv, int x, int y) const
+{
+	if (isButtonOnly())
+		//no context menu (yet) for ButtonOnly insets
+		return string();
+
+	return InsetCollapsible::contextMenu(bv, x, y);
+}
+
+} // namespace lyx
diff --git a/src/insets/InsetDynamicArgs.h b/src/insets/InsetDynamicArgs.h
new file mode 100644
index 0000000000..8d8086b258
--- /dev/null
+++ b/src/insets/InsetDynamicArgs.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+/**
+ * \file InsetDynamicArgs.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Jürgen Spitzmüller
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef INSETDYNAMICARGS_H
+#define INSETDYNAMICARGS_H
+
+#include "InsetCollapsible.h"
+
+
+namespace lyx {
+
+/** A derivate of collapsible with dynamic arguments
+
+*/
+class InsetDynamicArgs : public InsetCollapsible {
+public:
+	///
+	InsetDynamicArgs(Buffer *);
+	///
+	bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
+	///
+	void draw(PainterInfo & pi, int x, int y) const override;
+	///
+	void metrics(MetricsInfo &, Dimension &) const override;
+	///
+	Geometry geometry(BufferView const & bv) const;
+	///
+	bool editable() const override;
+	/// can we go further down on mouse click?
+	bool descendable(BufferView const & bv) const override;
+	/// Returns true if coordinates are over the inset's button.
+	/// Always returns false when the inset does not have a
+	/// button.
+	bool clickable(BufferView const & bv, int x, int y) const override;
+	///
+	void latex(otexstream &, OutputParams const &) const override;
+	///
+	std::string contextMenu(BufferView const & bv, int x, int y) const override;
+	/// A simple command inset without any arguments
+	bool isButtonOnly() const;
+
+protected:
+	///
+	InsetDynamicArgs(InsetDynamicArgs const &);
+
+private:
+	///
+	Inset * clone() const override { return new InsetDynamicArgs(*this); }
+	///
+	std::string name_;
+};
+
+
+} // namespace lyx
+
+#endif
diff --git a/src/insets/InsetFlex.cpp b/src/insets/InsetFlex.cpp
index 8ef483582f..0446efb69b 100644
--- a/src/insets/InsetFlex.cpp
+++ b/src/insets/InsetFlex.cpp
@@ -35,12 +35,12 @@ namespace lyx {
 
 
 InsetFlex::InsetFlex(Buffer * buf, string const & layoutName)
-	: InsetCollapsible(buf), name_(layoutName)
+	: InsetDynamicArgs(buf), name_(layoutName)
 {}
 
 
 InsetFlex::InsetFlex(InsetFlex const & in)
-	: InsetCollapsible(in), name_(in.name_)
+	: InsetDynamicArgs(in), name_(in.name_)
 {}
 
 
@@ -60,6 +60,8 @@ InsetLayout const & InsetFlex::getLayout() const
 
 InsetDecoration InsetFlex::decoration() const
 {
+	if (isButtonOnly())
+		return InsetDecoration::DEFAULT;
 	InsetDecoration const dec = getLayout().decoration();
 	return dec == InsetDecoration::DEFAULT ? InsetDecoration::CONGLOMERATE : dec;
 }
@@ -86,13 +88,16 @@ void InsetFlex::write(ostream & os) const
 		}
 	}
 	os << name << "\n";
-	InsetCollapsible::write(os);
+	InsetDynamicArgs::write(os);
 }
 
 
 bool InsetFlex::getStatus(Cursor & cur, FuncRequest const & cmd,
 		FuncStatus & flag) const
 {
+	if (getLayout().latextype() == InsetLaTeXType::SIMPLE_COMMAND)
+		return InsetDynamicArgs::getStatus(cur, cmd, flag);
+
 	switch (cmd.action()) {
 	case LFUN_INSET_SPLIT:
 	case LFUN_INSET_DISSOLVE:
@@ -104,13 +109,13 @@ bool InsetFlex::getStatus(Cursor & cur, FuncRequest const & cmd,
 			    || (il.name() == InsetLayout::undefined().name()
 				    && type == InsetLyXType::CHARSTYLE)) {
 				FuncRequest temp_cmd(cmd.action());
-				return InsetCollapsible::getStatus(cur, temp_cmd, flag);
+				return InsetDynamicArgs::getStatus(cur, temp_cmd, flag);
 			} else
 				return false;
 		}
 		// fall-through
 	default:
-		return InsetCollapsible::getStatus(cur, cmd, flag);
+		return InsetDynamicArgs::getStatus(cur, cmd, flag);
 	}
 }
 
@@ -129,14 +134,14 @@ void InsetFlex::doDispatch(Cursor & cur, FuncRequest & cmd)
 			    || (il.name() == InsetLayout::undefined().name()
 				    && type == InsetLyXType::CHARSTYLE)) {
 				FuncRequest temp_cmd(cmd.action());
-				InsetCollapsible::doDispatch(cur, temp_cmd);
+				InsetDynamicArgs::doDispatch(cur, temp_cmd);
 			} else
 				cur.undispatched();
 			break;
 		}
 		// fall-through
 	default:
-		InsetCollapsible::doDispatch(cur, cmd);
+		InsetDynamicArgs::doDispatch(cur, cmd);
 		break;
 	}
 }
@@ -172,7 +177,7 @@ void InsetFlex::updateBuffer(ParIterator const & it, UpdateType utype, bool cons
 	}
 	setLabel(custom_label);
 
-	InsetCollapsible::updateBuffer(it, utype, deleted);
+	InsetDynamicArgs::updateBuffer(it, utype, deleted);
 	if (have_counter)
 		cnts.restoreLastCounter();
 }
diff --git a/src/insets/InsetFlex.h b/src/insets/InsetFlex.h
index f7ea07a0c3..4b78d94eb4 100644
--- a/src/insets/InsetFlex.h
+++ b/src/insets/InsetFlex.h
@@ -13,7 +13,7 @@
 #ifndef INSETFLEX_H
 #define INSETFLEX_H
 
-#include "InsetCollapsible.h"
+#include "InsetDynamicArgs.h"
 
 
 namespace lyx {
@@ -21,7 +21,7 @@ namespace lyx {
 /** The Flex inset, e.g., CharStyle, Custom inset or XML short element
 
 */
-class InsetFlex : public InsetCollapsible {
+class InsetFlex : public InsetDynamicArgs {
 public:
 	///
 	InsetFlex(Buffer *, std::string const & layoutName);
diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp
index 2b6ba3a6e4..5c12f00bcc 100644
--- a/src/insets/InsetLayout.cpp
+++ b/src/insets/InsetLayout.cpp
@@ -49,6 +49,8 @@ InsetLaTeXType translateLaTeXType(std::string const & str)
 {
 	if (compare_ascii_no_case(str, "command") == 0)
 		return InsetLaTeXType::COMMAND;
+	if (compare_ascii_no_case(str, "simplecommand") == 0)
+		return InsetLaTeXType::SIMPLE_COMMAND;
 	if (compare_ascii_no_case(str, "environment") == 0)
 		return InsetLaTeXType::ENVIRONMENT;
 	if (compare_ascii_no_case(str, "none") == 0)
diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h
index 1f4c29dc51..d28d75d61b 100644
--- a/src/insets/InsetLayout.h
+++ b/src/insets/InsetLayout.h
@@ -45,6 +45,7 @@ enum class InsetLyXType : int {
 enum class InsetLaTeXType : int {
 	NOLATEXTYPE,
 	COMMAND,
+	SIMPLE_COMMAND,
 	ENVIRONMENT,
 	ILT_ERROR
 };


More information about the lyx-cvs mailing list