]> git.lyx.org Git - features.git/commitdiff
fix crash due to wrong export of AMS's pmatrix etc in math-extern
authorAndré Pönitz <poenitz@gmx.net>
Wed, 24 Apr 2002 17:07:42 +0000 (17:07 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 24 Apr 2002 17:07:42 +0000 (17:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4060 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_amsarrayinset.C
src/mathed/math_amsarrayinset.h
src/mathed/math_extern.C
src/mathed/math_inset.h
src/mathed/math_mathmlstream.C
src/mathed/math_mathmlstream.h
src/mathed/math_matrixinset.C
src/mathed/math_matrixinset.h

index efd88cf89f6e31052c9fbfb6eb5b702e38162829..367c44669dcbb151fd3486eb5875f50177f51279 100644 (file)
@@ -90,10 +90,3 @@ void MathAMSArrayInset::normalize(NormalStream & os) const
        os << "]";
 }
 
-
-void MathAMSArrayInset::maplize(MapleStream & os) const
-{
-       os << name_ << "(";
-       MathGridInset::maplize(os);
-       os << ")";
-}
index 27154a99bef6e97d28ca69f63450d1c4d3238434..6f9d39809f8417e74720377baafeb1bd43d7e8f5 100644 (file)
@@ -28,8 +28,6 @@ public:
        void write(WriteStream & os) const;
        ///
        void normalize(NormalStream &) const;
-       ///
-       void maplize(MapleStream &) const;
 
 private:
        ///
index 1f9e5167523acf8c6f27b44f8b0be685931b07ef..0e0a5280124af19ad0824db6fbbf10e2c252878a 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <algorithm>
 
+#include "math_amsarrayinset.h"
 #include "math_charinset.h"
 #include "math_deliminset.h"
 #include "math_diffinset.h"
@@ -164,14 +165,23 @@ MathInset * singleItem(MathArray & ar)
 void extractMatrices(MathArray & ar)
 {
        //lyxerr << "\nMatrices from: " << ar << "\n";
+       // first pass for explicitly delimited stuff
        for (MathArray::iterator it = ar.begin(); it != ar.end(); ++it) {
                MathDelimInset * del = (*it)->asDelimInset();
                if (!del)
                        continue;
                MathInset * arr = singleItem(del->cell(0));
-               if (!arr || !arr->asArrayInset())
+               if (!arr || !arr->asGridInset())
                        continue;
-               *it = MathAtom(new MathMatrixInset(*(arr->asArrayInset())));
+               *it = MathAtom(new MathMatrixInset(*(arr->asGridInset())));
+       }
+
+       // second pass for AMS "pmatrix" etc
+       for (MathArray::iterator it = ar.begin(); it != ar.end(); ++it) {
+               MathAMSArrayInset * ams = (*it)->asAMSArrayInset();
+               if (!ams)
+                       continue;
+               *it = MathAtom(new MathMatrixInset(*ams));
        }
        //lyxerr << "\nMatrices to: " << ar << "\n";
 }
index 20662bdb853296f88c367c106c8b3e2f1763a3d9..3bdff2dbbfd94c905fe61afec9b5817aa9b8a0d9 100644 (file)
@@ -47,6 +47,7 @@ inclusion in the "real LyX insets" FormulaInset and FormulaMacroInset.
 
 
 class MathArrayInset;
+class MathAMSArrayInset;
 class MathBraceInset;
 class MathBoxInset;
 class MathCharInset;
@@ -182,6 +183,7 @@ public:
        virtual bool validCell(idx_type) const { return true; }
 
        /// identifies certain types of insets
+       virtual MathAMSArrayInset      * asAMSArrayInset()      { return 0; }
        virtual MathArrayInset         * asArrayInset()         { return 0; }
        virtual MathBraceInset         * asBraceInset()         { return 0; }
        virtual MathBoxInset           * asBoxInset()           { return 0; }
index 9f9c1dc7d5d52b538f5a1c7e45618744de316e4f..a10691ea1b53412e39fbf64a438445bcf7878110 100644 (file)
@@ -149,6 +149,13 @@ OctaveStream & operator<<(OctaveStream & ns, char c)
 }
 
 
+OctaveStream & operator<<(OctaveStream & ns, int i)
+{
+       ns.os() << i;
+       return ns;
+}
+
+
 //////////////////////////////////////////////////////////////////////
 
 
index 364e5c10778e7e070c7b70db6ba922d9fd995c66..744156946ea6270481ab58796b55cc58b54549be 100644 (file)
@@ -150,6 +150,8 @@ OctaveStream & operator<<(OctaveStream &, MathArray const &);
 OctaveStream & operator<<(OctaveStream &, char const *);
 ///
 OctaveStream & operator<<(OctaveStream &, char);
+///
+OctaveStream & operator<<(OctaveStream &, int);
 
 
 
index 25cece5aa9736617620749752cc35cdb99d146a6..330c3cef62b0ff46ef2e775e4962c270c3c24bc1 100644 (file)
@@ -8,8 +8,8 @@
 #include "Lsstream.h"
 
 
-MathMatrixInset::MathMatrixInset(MathArrayInset const & p)
-       : MathArrayInset(p)
+MathMatrixInset::MathMatrixInset(MathGridInset const & p)
+       : MathGridInset(p)
 {}
 
 
@@ -21,13 +21,13 @@ MathInset * MathMatrixInset::clone() const
 
 void MathMatrixInset::write(WriteStream & os) const
 {
-       MathArrayInset::write(os);
+       MathGridInset::write(os);
 }
 
 
 void MathMatrixInset::normalize(NormalStream & os) const
 {
-       MathArrayInset::normalize(os);
+       MathGridInset::normalize(os);
 }
 
 
index dd1636131b7d9e9243af42b83a09e64e3140bfd9..57d45d61ea39f46ffdd7191c449e8695bdc49af9 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef MATH_MATRIXINSET_H
 #define MATH_MATRIXINSET_H
 
-#include "math_arrayinset.h"
+#include "math_gridinset.h"
 
 #ifdef __GNUG__
 #pragma interface
 
 // "shortcut" for DelimInset("(",ArrayInset,")")
 
-class MathMatrixInset : public MathArrayInset {
+class MathMatrixInset : public MathGridInset {
 public:
        ///
-       MathMatrixInset(MathArrayInset const &);
+       MathMatrixInset(MathGridInset const &);
        ///
        MathMatrixInset(string const & str);
        ///