]> git.lyx.org Git - features.git/commitdiff
Fix for 594
authorAndré Pönitz <poenitz@gmx.net>
Tue, 7 Jan 2003 09:42:10 +0000 (09:42 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 7 Jan 2003 09:42:10 +0000 (09:42 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5908 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/math_hullinset.C

index ac4f78058e66cf3e1397a6683824f9b1e1317034..5ebce3813378bbe04760b322b5d64650dc9bf070 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-07  João Luis Meloni Assirati <assirati@fma.if.usp.br>
+       * math_hullinset.C: fix numbering problem of AMS gather and
+       multline environments (bugs 518 and 594). Treat gather the same
+       way as eqnarray and multline as a special case.
+
 2002-12-18  John Levon  <levon@movementarian.org>
 
        * math_factory.C: do not assume symbol font is present
index 8ca015561604cbec1f9e9b64aab616db4dc447e4..dfefb4faeb9cd6d4ac40976cdbda990ab368c885 100644 (file)
@@ -358,7 +358,8 @@ void MathHullInset::header_write(WriteStream & os) const
                        os << "\\[\n";
        }
 
-       else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign")
+       else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign"
+                || type_ == "gather" || type_ == "multline")
                        os << "\\begin{" << type_ << star(n) << "}\n";
 
        else if (type_ == "alignat" || type_ == "xalignat")
@@ -369,9 +370,6 @@ void MathHullInset::header_write(WriteStream & os) const
                os << "\\begin{" << type_ << '}'
                  << '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n";
 
-       else if (type_ == "multline" || type_ == "gather")
-               os << "\\begin{" << type_ << "}\n";
-
        else
                os << "\\begin{unknown" << star(n) << '}';
 }
@@ -394,10 +392,11 @@ void MathHullInset::footer_write(WriteStream & os) const
                        os << "\\]\n";
 
        else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign"
-            || type_ == "alignat" || type_ == "xalignat")
-               os << "\\end{" << type_ << star(n) << "}\n";
+                || type_ == "alignat" || type_ == "xalignat"
+                || type_ == "gather" || type_ == "multline")
+               os << "\\end{" << type_ << star(n) << "}\n";
 
-       else if (type_ == "xxalignat" || type_ == "multline" || type_ == "gather")
+       else if (type_ == "xxalignat")
                os << "\\end{" << type_ << "}\n";
 
        else
@@ -627,7 +626,7 @@ string MathHullInset::eolString(row_type row, bool fragile) const
        if (numberedType()) {
                if (!label_[row].empty() && !nonum_[row])
                        res += "\\label{" + label_[row] + '}';
-               if (nonum_[row])
+               if (nonum_[row] && (type_ != "multline"))
                        res += "\\nonumber ";
        }
        return res + MathGridInset::eolString(row, fragile);
@@ -766,8 +765,11 @@ MathInset::result_type MathHullInset::dispatch
                        if (display()) {
                                //bv->lockedInsetStoreUndo(Undo::INSERT);
                                bool old = numberedType();
-                               for (row_type row = 0; row < nrows(); ++row)
-                                       numbered(row, !old);
+                               if (type_ == "multline")
+                                       numbered(nrows() - 1, !old);
+                               else
+                                       for (row_type row = 0; row < nrows(); ++row)
+                                               numbered(row, !old);
                                //bv->owner()->message(old ? _("No number") : _("Number"));
                                //updateLocal(bv, true);
                        }
@@ -775,16 +777,17 @@ MathInset::result_type MathHullInset::dispatch
 
                case LFUN_MATH_NONUMBER:
                        if (display()) {
+                               row_type r = (type_ == "multline") ? nrows() - 1 : row(idx);
                                //bv->lockedInsetStoreUndo(Undo::INSERT);
-                               bool old = numbered(row(idx));
+                               bool old = numbered(r);
                                //bv->owner()->message(old ? _("No number") : _("Number"));
-                               numbered(row(idx), !old);
+                               numbered(r, !old);
                                //updateLocal(bv, true);
                        }
                        return DISPATCHED;
 
                case LFUN_INSERT_LABEL: {
-                       row_type r = row(idx);
+                       row_type r = (type_ == "multline") ? nrows() - 1 : row(idx);
                        string old_label = label(r);
                        string new_label = cmd.argument;