]> git.lyx.org Git - features.git/commitdiff
improve support for align and alignat
authorAndré Pönitz <poenitz@gmx.net>
Tue, 4 Sep 2001 08:48:23 +0000 (08:48 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 4 Sep 2001 08:48:23 +0000 (08:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2677 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_matrixinset.C
src/mathed/math_matrixinset.h
src/mathed/math_parser.C

index f03b92feb5efe867698e6d52b0232b5bd3ad76ad..87b50e14291126559f725848c4e033ede9e51ba4 100644 (file)
@@ -77,6 +77,12 @@ int firstRelOp(MathArray const & array)
 
 }
 
+
+MathMatrixInset::MathMatrixInset()
+       : MathGridInset(1, 1), objtype_(LM_OT_SIMPLE), nonum_(1), label_(1)
+{}
+
+
 MathMatrixInset::MathMatrixInset(MathInsetTypes t)
        : MathGridInset(getCols(t), 1), objtype_(t), nonum_(1), label_(1)
 {
@@ -84,9 +90,12 @@ MathMatrixInset::MathMatrixInset(MathInsetTypes t)
 }
 
 
-MathMatrixInset::MathMatrixInset()
-       : MathGridInset(1, 1), objtype_(LM_OT_SIMPLE), nonum_(1), label_(1)
-{}
+MathMatrixInset::MathMatrixInset(MathInsetTypes t, int cols)
+       : MathGridInset(cols, 1), objtype_(t), nonum_(1), label_(1)
+{
+       halign(getAlign(t, ncols()));
+}
+
 
 MathInset * MathMatrixInset::clone() const
 {
@@ -170,6 +179,7 @@ string MathMatrixInset::label(int row) const
        return label_[row];
 }
 
+
 void MathMatrixInset::label(int row, string const & label)
 {
        label_[row] = label; 
index a48af2f1cb5f9e3b85c4810094c8441852bd698f..a8ef98edb71035707fd90a4bd8492bc262be90fe 100644 (file)
@@ -23,6 +23,8 @@ public:
        ///
        explicit MathMatrixInset(MathInsetTypes t);
        ///
+       MathMatrixInset(MathInsetTypes t, int cols);
+       ///
        MathInset * clone() const;
        ///
        void write(std::ostream &, bool fragile) const;
index d3915d02636b419d9d4785fbb76a545079519058..f7dcde03cbc574d3dc6dc69ca643ca0fab537ed8 100644 (file)
@@ -591,14 +591,13 @@ MathMatrixInset * Parser::parse_normal()
 
        if (name == "align" || name == "align*") {
                MathMatrixInset * p = new MathMatrixInset(LM_OT_ALIGN);
-               p->halign(getArg('{', '}'));
                parse_lines(p, !stared(name), true);
                return p;
        }
 
        if (name == "alignat" || name == "alignat*") {
-               MathMatrixInset * p = new MathMatrixInset(LM_OT_ALIGNAT);
-               p->halign(getArg('{', '}'));
+               MathMatrixInset * p =
+                       new MathMatrixInset(LM_OT_ALIGNAT, 2 * atoi(getArg('{', '}').c_str()));
                parse_lines(p, !stared(name), true);
                return p;
        }