]> git.lyx.org Git - features.git/commitdiff
readd xymatrix inset (bug 2238)
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Wed, 22 Feb 2006 12:26:06 +0000 (12:26 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Wed, 22 Feb 2006 12:26:06 +0000 (12:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13265 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/Makefile.am
src/mathed/math_factory.C
src/mathed/math_parser.C
src/mathed/math_xymatrixinset.C [new file with mode: 0644]
src/mathed/math_xymatrixinset.h [new file with mode: 0644]

index ac4b0002f451942c661f55224a8f0ec2326a0300..b6431c8cab398440e6f2269dd385cbef10dedd36 100644 (file)
@@ -1,3 +1,10 @@
+2006-02-17  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
+
+       * math_xymatrixinset.[Ch]: Readd
+       * Makefile.am: Readd math_xymatrixinset.[Ch]
+       * math_factory.C (createMathInset): Readd xymatrix
+       * math_parser.C (parse1): Readd xymatrix
+
 2006-02-13  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * math_macro.C (editXY): Prevent crash (fix by Andrew Beck)
index 62cca54f1033f23eee48e8578aa1b6692064d373..1ae44042608b035e6a536f885be4dfd79c5f872a 100644 (file)
@@ -147,6 +147,8 @@ libmathed_la_SOURCES = \
        math_undersetinset.h \
        math_xarrowinset.C \
        math_xarrowinset.h \
+       math_xymatrixinset.C \
+       math_xymatrixinset.h \
        command_inset.h \
        command_inset.C \
        ref_inset.h \
index e0529ad5e4472b630170b38d1d4ca2da9540e671..9faf0e80909cffab68c29fff64874a606a21a425 100644 (file)
@@ -50,6 +50,7 @@
 #include "math_undersetinset.h"
 #include "math_unknowninset.h"
 #include "math_xarrowinset.h"
+#include "math_xymatrixinset.h"
 
 //#include "insets/insetref.h"
 #include "ref_inset.h"
@@ -292,6 +293,8 @@ MathAtom createMathInset(string const & s)
                return MathAtom(new MathMakeboxInset);
        if (s == "kern")
                return MathAtom(new MathKernInset);
+       if (s == "xymatrix")
+               return MathAtom(new MathXYMatrixInset);
        if (s == "xrightarrow" || s == "xleftarrow")
                return MathAtom(new MathXArrowInset(s));
        if (s == "split" || s == "gathered" || s == "aligned" || s == "alignedat")
index a050a512cc55c5cccaddb4fdefd1d4c384768359..be12a451e55004f885095806144fecdb5eb445cc 100644 (file)
@@ -1248,6 +1248,11 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
                        parse2(cell->back(), FLAG_ITEM, mode, false);
                }
 
+               else if (t.cs() == "xymatrix") {
+                       cell->push_back(createMathInset(t.cs()));
+                       parse2(cell->back(), FLAG_ITEM, mode, false);
+               }
+
                else if (t.cs() == "framebox" || t.cs() == "makebox") {
                        cell->push_back(createMathInset(t.cs()));
                        parse(cell->back().nucleus()->cell(0), FLAG_OPTION, MathInset::TEXT_MODE);
diff --git a/src/mathed/math_xymatrixinset.C b/src/mathed/math_xymatrixinset.C
new file mode 100644 (file)
index 0000000..581dab3
--- /dev/null
@@ -0,0 +1,80 @@
+/**
+ * \file math_xymatrixinset.C
+ * 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 "math_xymatrixinset.h"
+#include "math_mathmlstream.h"
+#include "math_streamstr.h"
+
+#include "LaTeXFeatures.h"
+#include "support/std_ostream.h"
+
+
+MathXYMatrixInset::MathXYMatrixInset()
+       : MathGridInset(1, 1)
+{}
+
+
+std::auto_ptr<InsetBase> MathXYMatrixInset::doClone() const
+{
+       return std::auto_ptr<InsetBase>(new MathXYMatrixInset(*this));
+}
+
+
+int MathXYMatrixInset::colsep() const
+{
+       return 40;
+}
+
+
+int MathXYMatrixInset::rowsep() const
+{
+       return 40;
+}
+
+
+void MathXYMatrixInset::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+       if (mi.base.style == LM_ST_DISPLAY)
+               mi.base.style = LM_ST_TEXT;
+       MathGridInset::metrics(mi, dim);
+}
+
+
+void MathXYMatrixInset::write(WriteStream & os) const
+{
+       os << "\\xymatrix{";
+       MathGridInset::write(os);
+       os << "}\n";
+}
+
+
+void MathXYMatrixInset::infoize(std::ostream & os) const
+{
+       os << "xymatrix ";
+       MathGridInset::infoize(os);
+}
+
+
+void MathXYMatrixInset::normalize(NormalStream & os) const
+{
+       os << "[xymatrix ";
+       MathGridInset::normalize(os);
+       os << ']';
+}
+
+
+void MathXYMatrixInset::maple(MapleStream & os) const
+{
+       os << "xymatrix(";
+       MathGridInset::maple(os);
+       os << ')';
+}
diff --git a/src/mathed/math_xymatrixinset.h b/src/mathed/math_xymatrixinset.h
new file mode 100644 (file)
index 0000000..d27e3e3
--- /dev/null
@@ -0,0 +1,47 @@
+// -*- C++ -*-
+/**
+ * \file math_xymatrixinset.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_XYMATRIX_H
+#define MATH_XYMATRIX_H
+
+#include "lyxlength.h"
+#include "math_gridinset.h"
+
+
+class MathXYMatrixInset : public MathGridInset {
+public:
+       ///
+       MathXYMatrixInset();
+       ///
+       void metrics(MetricsInfo &, Dimension &) const;
+       ///
+       MathXYMatrixInset const * asXYMatrixInset() const { return this; }
+       ///
+       virtual int colsep() const;
+       ///
+       virtual int rowsep() const;
+
+       ///
+       void normalize();
+       ///
+       void write(WriteStream & os) const;
+       ///
+       void infoize(std::ostream & os) const;
+       ///
+       void normalize(NormalStream &) const;
+       ///
+       void maple(MapleStream &) const;
+private:
+       ///
+       virtual std::auto_ptr<InsetBase> doClone() const;
+};
+
+#endif