]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathSplit.C
Fix comment according to Enricos explanation
[lyx.git] / src / mathed / InsetMathSplit.C
index b78c5708f332a15f2b343a83a79b537c49f0e5be..00dd9e87ee7e0286d39c24c5cad4e952d7a7d3a1 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "InsetMathSplit.h"
 #include "MathData.h"
-#include "MathMLStream.h"
+#include "MathStream.h"
 #include "MathStream.h"
 
 #include "funcrequest.h"
 #include "support/std_ostream.h"
 
 
-using lyx::docstring;
-using lyx::support::bformat;
+namespace lyx {
+
+using support::bformat;
+
 using std::string;
 using std::auto_ptr;
 
 
-InsetMathSplit::InsetMathSplit(string const & name)
-       : InsetMathGrid(1, 1), name_(name)
+InsetMathSplit::InsetMathSplit(docstring const & name, char valign)
+       : InsetMathGrid(1, 1, valign, docstring()), name_(name)
 {
-       setDefaults();
 }
 
 
@@ -72,8 +73,7 @@ bool InsetMathSplit::getStatus(LCursor & cur, FuncRequest const & cmd,
                docstring const & s = cmd.argument();
                if (s == "add-vline-left" || s == "add-vline-right") {
                        flag.message(bformat(
-                       lyx::from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
-                       lyx::from_utf8(name_)));
+                               from_utf8(N_("Can't add vertical grid lines in '%1$s'")),       name_));
                        flag.enabled(false);
                        return true;
                }
@@ -90,6 +90,8 @@ void InsetMathSplit::write(WriteStream & ws) const
        if (ws.fragile())
                ws << "\\protect";
        ws << "\\begin{" << name_ << '}';
+       if (name_ != "split" && valign() != 'c')
+               ws << '[' << valign() << ']';
        if (name_ == "alignedat")
                ws << '{' << static_cast<unsigned int>((ncols() + 1)/2) << '}';
        InsetMathGrid::write(ws);
@@ -99,16 +101,21 @@ void InsetMathSplit::write(WriteStream & ws) const
 }
 
 
-void InsetMathSplit::infoize(std::ostream & os) const
+void InsetMathSplit::infoize(odocstream & os) const
 {
-       string name = name_;
-       name[0] = lyx::support::uppercase(name[0]);
+       docstring name = name_;
+       name[0] = support::uppercase(name[0]);
        os << name << ' ';
 }
 
 
 void InsetMathSplit::validate(LaTeXFeatures & features) const
 {
-       features.require("amsmath");
-       InsetMathNest::validate(features);
+       if (name_ == "split" || name_ == "gathered" || name_ == "aligned" ||
+           name_ == "alignedat")
+               features.require("amsmath");
+       InsetMathGrid::validate(features);
 }
+
+
+} // namespace lyx