]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_hullinset.C
enable direct input of #1...#9; some whitespace changes
[lyx.git] / src / mathed / math_hullinset.C
index 535a7c44c3a6947303cae594c268d58fd93d0805..0e0db0d0d01ab24022ccb0f9d007e242723fcefd 100644 (file)
@@ -1,16 +1,21 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include <vector>
-
 #include "math_hullinset.h"
+#include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "math_support.h"
 #include "debug.h"
 #include "Painter.h"
 #include "LaTeXFeatures.h"
-#include "math_mathmlstream.h"
+#include "support/LAssert.h"
+
+#include <vector>
 
+using std::endl;
 
 namespace {
 
@@ -32,7 +37,7 @@ namespace {
 
        // returns position of first relation operator in the array
        // used for "intelligent splitting"
-       int firstRelOp(MathArray const & ar)
+       MathArray::size_type firstRelOp(MathArray const & ar)
        {
                for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
                        if ((*it)->isRelOp())
@@ -187,6 +192,8 @@ void MathHullInset::draw(Painter & pain, int x, int y) const
 
 string MathHullInset::label(row_type row) const
 {
+       row_type n = nrows();
+       lyx::Assert(row < n);
        return label_[row];
 }
 
@@ -212,7 +219,7 @@ bool MathHullInset::numbered(row_type row) const
 bool MathHullInset::ams() const
 {
        return true;
-
+/*
        return 
                objtype_ == LM_OT_ALIGN ||
                objtype_ == LM_OT_MULTLINE ||
@@ -220,6 +227,7 @@ bool MathHullInset::ams() const
                objtype_ == LM_OT_ALIGNAT ||
                objtype_ == LM_OT_XALIGNAT ||
                objtype_ == LM_OT_XXALIGNAT;
+*/
 }
 
 
@@ -253,7 +261,7 @@ bool MathHullInset::numberedType() const
 void MathHullInset::validate(LaTeXFeatures & features) const
 {
        if (ams())
-               features.require("amsstyle");
+               features.require("amsmath");
 
 
        // Validation is necessary only if not using AMS math.
@@ -608,7 +616,8 @@ void MathHullInset::mutate(MathInsetTypes newtype)
 
                                default:
                                        lyxerr << "mutation from '" << getType()
-                                               << "' to '" << newtype << "' not implemented\n";
+                                               << "' to '" << newtype << "' not implemented"
+                                              << endl;
                                        break;
                        }
                        break;
@@ -620,7 +629,8 @@ void MathHullInset::mutate(MathInsetTypes newtype)
                                        break;
                                default:
                                        lyxerr << "mutation from '" << getType()
-                                               << "' to '" << newtype << "' not implemented\n";
+                                               << "' to '" << newtype << "' not implemented"
+                                              << endl;
                                        break;
                        }
 
@@ -631,42 +641,45 @@ void MathHullInset::mutate(MathInsetTypes newtype)
                                        break;
                                default:
                                        lyxerr << "mutation from '" << getType()
-                                               << "' to '" << newtype << "' not implemented\n";
+                                               << "' to '" << newtype << "' not implemented"
+                                              << endl;
                                        break;
                        }
 
                default:
                        lyxerr << "mutation from '" << getType()
-                               << "' to '" << newtype << "' not implemented\n";
+                              << "' to '" << newtype << "' not implemented"
+                              << endl;
+                       break;
        }
 }
 
 
 void MathHullInset::write(WriteStream & os) const
 {
-  header_write(os);
-
+       header_write(os);
+       
        bool n = numberedType();
-
+       
        for (row_type row = 0; row < nrows(); ++row) {
                for (col_type col = 0; col < ncols(); ++col) 
-                       os << cell(index(row, col)) << eocString(col).c_str();
+                       os << cell(index(row, col)) << eocString(col);
                if (n) {
                        if (!label_[row].empty())
-                               os << "\\label{" << label_[row].c_str() << "}";
+                               os << "\\label{" << label_[row] << "}";
                        if (nonum_[row])
                                os << "\\nonumber ";
                }
-               os << eolString(row).c_str();
+               os << eolString(row);
        }
-
-  footer_write(os);
+       
+       footer_write(os);
 }
 
 
 void MathHullInset::normalize(NormalStream & os) const
 {
-       os << "[formula " << normalName(getType()).c_str() << " ";
+       os << "[formula " << normalName(getType()) << " ";
        MathGridInset::normalize(os);
        os << "] ";
 }
@@ -678,3 +691,10 @@ void MathHullInset::mathmlize(MathMLStream & os) const
 }
 
 
+void MathHullInset::check() const
+{
+       lyx::Assert(nonum_.size() == nrows());
+       lyx::Assert(label_.size() == nrows());
+}
+
+