From: André Pönitz Date: Tue, 4 Sep 2001 08:48:23 +0000 (+0000) Subject: improve support for align and alignat X-Git-Tag: 1.6.10~20669 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b07b7528ff27c35aeabbf622159737aac1f7ef3b;p=features.git improve support for align and alignat git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2677 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/math_matrixinset.C b/src/mathed/math_matrixinset.C index f03b92feb5..87b50e1429 100644 --- a/src/mathed/math_matrixinset.C +++ b/src/mathed/math_matrixinset.C @@ -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; diff --git a/src/mathed/math_matrixinset.h b/src/mathed/math_matrixinset.h index a48af2f1cb..a8ef98edb7 100644 --- a/src/mathed/math_matrixinset.h +++ b/src/mathed/math_matrixinset.h @@ -23,6 +23,8 @@ public: /// explicit MathMatrixInset(MathInsetTypes t); /// + MathMatrixInset(MathInsetTypes t, int cols); + /// MathInset * clone() const; /// void write(std::ostream &, bool fragile) const; diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index d3915d0263..f7dcde03cb 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -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; }