]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathXYMatrix.C
Fix comment according to Enricos explanation
[lyx.git] / src / mathed / InsetMathXYMatrix.C
index 7c71762638f78c81d062dc42acd69214d77e20cf..679f2712890268e3bf00df60154b3e1139e65703 100644 (file)
 #include <config.h>
 
 #include "InsetMathXYMatrix.h"
-#include "MathMLStream.h"
 #include "MathStream.h"
 
 #include "LaTeXFeatures.h"
 #include "support/std_ostream.h"
 
 
-InsetMathXYMatrix::InsetMathXYMatrix()
-       : InsetMathGrid(1, 1)
+namespace lyx {
+
+
+InsetMathXYMatrix::InsetMathXYMatrix(LyXLength const & s, char c)
+       : InsetMathGrid(1, 1), spacing_(s), spacing_code_(c)
 {}
 
 
@@ -51,15 +53,44 @@ void InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetMathXYMatrix::write(WriteStream & os) const
 {
-       os << "\\xymatrix{";
+       os << "\\xymatrix";
+       switch (spacing_code_) {
+       case 'R':
+       case 'C':
+       case 'M':
+       case 'W':
+       case 'H':
+       case 'L':
+               os << '@' << spacing_code_ << '='
+                  << from_ascii(spacing_.asLatexString());
+               break;
+       default:
+               if (!spacing_.empty())
+                       os << "@=" << from_ascii(spacing_.asLatexString());
+       }
+       os << '{';
        InsetMathGrid::write(os);
        os << "}\n";
 }
 
 
-void InsetMathXYMatrix::infoize(std::ostream & os) const
+void InsetMathXYMatrix::infoize(odocstream & os) const
 {
        os << "xymatrix ";
+       switch (spacing_code_) {
+       case 'R':
+       case 'C':
+       case 'M':
+       case 'W':
+       case 'H':
+       case 'L':
+               os << spacing_code_ << ' '
+                  << from_ascii(spacing_.asLatexString()) << ' ';
+               break;
+       default:
+               if (!spacing_.empty())
+                       os << from_ascii(spacing_.asLatexString()) << ' ';
+       }
        InsetMathGrid::infoize(os);
 }
 
@@ -78,3 +109,13 @@ void InsetMathXYMatrix::maple(MapleStream & os) const
        InsetMathGrid::maple(os);
        os << ')';
 }
+
+
+void InsetMathXYMatrix::validate(LaTeXFeatures & features) const
+{
+       features.require("xy");
+       InsetMathGrid::validate(features);
+}
+
+
+} // namespace lyx