]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathAMSArray.cpp
Routines for calculating numerical labels for BibTeX citations.
[lyx.git] / src / mathed / InsetMathAMSArray.cpp
index 3a8c3783806f18d94dc2998f70c73b581633ea6a..b9efc3d0e2853631d2c20c98e3cf0e97312cdb60 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.
  */
@@ -32,13 +32,14 @@ namespace lyx {
 using support::bformat;
 
 
-InsetMathAMSArray::InsetMathAMSArray(docstring const & name, int m, int n)
-       : InsetMathGrid(m, n), name_(name)
+InsetMathAMSArray::InsetMathAMSArray(Buffer * buf, docstring const & name,
+               int m, int n)
+       : InsetMathGrid(buf, m, n), name_(name)
 {}
 
 
-InsetMathAMSArray::InsetMathAMSArray(docstring const & name)
-       : InsetMathGrid(1, 1), name_(name)
+InsetMathAMSArray::InsetMathAMSArray(Buffer * buf, docstring const & name)
+       : InsetMathGrid(buf, 1, 1), name_(name)
 {}
 
 
@@ -109,7 +110,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);
@@ -122,6 +123,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_ << '}';
@@ -146,7 +148,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);
 }