]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathAMSArray.cpp
Fix bug 5802 (http://bugzilla.lyx.org/show_bug.cgi?id=5802)
[lyx.git] / src / mathed / InsetMathAMSArray.cpp
index a8fdf68346e110ff1322dc954d10ae6229fc6855..9bcff0c41ffdd742b613262f4d969aecfdf9ce51 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -88,14 +88,6 @@ void InsetMathAMSArray::metrics(MetricsInfo & mi, Dimension & dim) const
 }
 
 
-Dimension const InsetMathAMSArray::dimension(BufferView const & bv) const
-{
-       Dimension dim = InsetMathGrid::dimension(bv);
-       dim.wid += 14;
-       return dim;
-}
-
-
 void InsetMathAMSArray::draw(PainterInfo & pi, int x, int y) const
 {
        Dimension const dim = dimension(*pi.base.bv);
@@ -117,7 +109,7 @@ bool InsetMathAMSArray::getStatus(Cursor & cur, FuncRequest const & cmd,
                if (s == "add-vline-left" || s == "add-vline-right") {
                        flag.message(bformat(
                                from_utf8(N_("Can't add vertical grid lines in '%1$s'")),       name_));
-                       flag.enabled(false);
+                       flag.setEnabled(false);
                        return true;
                }
                return InsetMathGrid::getStatus(cur, cmd, flag);
@@ -130,6 +122,7 @@ bool InsetMathAMSArray::getStatus(Cursor & cur, FuncRequest const & cmd,
 
 void InsetMathAMSArray::write(WriteStream & os) const
 {
+       MathEnsurer ensurer(os);
        os << "\\begin{" << name_ << '}';
        InsetMathGrid::write(os);
        os << "\\end{" << name_ << '}';
@@ -154,7 +147,12 @@ void InsetMathAMSArray::normalize(NormalStream & os) const
 
 void InsetMathAMSArray::validate(LaTeXFeatures & features) const
 {
-       features.require("amsmath");
+       if (name_ == "CD")
+               // amscd is independent of amsmath although it is part of
+               // the amsmath bundle
+               features.require("amscd");
+       else
+               features.require("amsmath");
        InsetMathGrid::validate(features);
 }