All they do is change the class of the elements that they contain.
mathed/InsetMathCancelto.cpp \
mathed/InsetMathCases.cpp \
mathed/InsetMathChar.cpp \
+ mathed/InsetMathClass.cpp \
mathed/InsetMathColor.cpp \
mathed/InsetMathComment.cpp \
mathed/InsetMathDecoration.cpp \
mathed/InsetMathCancelto.h \
mathed/InsetMathCases.h \
mathed/InsetMathChar.h \
+ mathed/InsetMathClass.h \
mathed/InsetMathColor.h \
mathed/InsetMathComment.h \
mathed/InsetMathDelim.h \
///
IPADECO_CODE,
///
+ MATH_CLASS_CODE,
+ ///
INSET_CODE_SIZE
};
--- /dev/null
+/**
+ * \file InsetMathClass.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "InsetMathClass.h"
+
+#include "support/docstream.h"
+
+
+namespace lyx {
+
+InsetMathClass::InsetMathClass(Buffer * buf, MathClass mc)
+ : InsetMathNest(buf, 1), math_class_(mc)
+{}
+
+
+Inset * InsetMathClass::clone() const
+{
+ return new InsetMathClass(*this);
+}
+
+
+void InsetMathClass::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+ cell(0).metrics(mi, dim);
+ metricsMarkers(dim);
+}
+
+
+void InsetMathClass::draw(PainterInfo & pi, int x, int y) const
+{
+ cell(0).draw(pi, x + 1, y);
+ drawMarkers(pi, x, y);
+}
+
+
+docstring InsetMathClass::name() const
+{
+ return class_to_string(math_class_);
+}
+
+
+void InsetMathClass::infoize(odocstream & os) const
+{
+ os << name() << " ";
+}
+
+
+} // namespace lyx
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file InsetMathClass.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef MATH_CLASSINSET_H
+#define MATH_CLASSINSET_H
+
+#include "MathClass.h"
+
+#include "InsetMathNest.h"
+
+
+namespace lyx {
+
+
+/// Support for LaTeX's \\mathxxx class-changing commands
+
+class InsetMathClass : public InsetMathNest {
+public:
+ ///
+ InsetMathClass(Buffer * buf, MathClass);
+ ///
+ docstring name() const;
+ ///
+ MathClass mathClass() const { return math_class_; }
+ ///
+ void metrics(MetricsInfo & mi, Dimension & dim) const;
+ ///
+ void draw(PainterInfo & pi, int x, int y) const;
+ ///
+ void infoize(odocstream & os) const;
+ ///
+ InsetCode lyxCode() const { return MATH_CLASS_CODE; }
+
+private:
+ virtual Inset * clone() const;
+ ///
+ MathClass math_class_;
+};
+
+
+} // namespace lyx
+#endif
#include "InsetMathCancel.h"
#include "InsetMathCancelto.h"
#include "InsetMathCases.h"
+#include "InsetMathClass.h"
#include "InsetMathColor.h"
#include "InsetMathDecoration.h"
#include "InsetMathDots.h"
return MathAtom(new InsetMathSpecialChar(s));
if (s == " ")
return MathAtom(new InsetMathSpace(" ", ""));
-
if (s == "regexp")
return MathAtom(new InsetMathHull(buf, hullRegexp));
+ MathClass const mc = string_to_class(s);
+ if (mc != MC_UNKNOWN)
+ return MathAtom(new InsetMathClass(buf, mc));
+
return MathAtom(new MathMacro(buf, s));
}