From: Enrico Forestieri Date: Thu, 19 Aug 2010 13:58:36 +0000 (+0000) Subject: Fix bug #6793: Changing an existing formula type to displayed formula loses the label X-Git-Tag: 2.0.0~2772 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=fa0cd9ad60f4367534dad47e82b4196882a28fb5;p=features.git Fix bug #6793: Changing an existing formula type to displayed formula loses the label git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35178 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index c12abd1c92..930f848a30 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -897,12 +897,20 @@ docstring InsetMathHull::nicelabel(row_type row) const } -void InsetMathHull::glueall() +void InsetMathHull::glueall(HullType type) { MathData ar; for (idx_type i = 0; i < nargs(); ++i) ar.append(cell(i)); + InsetLabel * label = 0; + if (type == hullEquation) { + // preserve the label + label = label_[0]; + label_[0] = 0; + } *this = InsetMathHull(buffer_, hullSimple); + if (label) + label_[0] = label; cell(0) = ar; setDefaults(); } @@ -1013,7 +1021,6 @@ void InsetMathHull::mutate(HullType newtype) numbered(0, false); } else { setType(hullEquation); - numbered(0, false); mutate(newtype); } } @@ -1039,15 +1046,6 @@ void InsetMathHull::mutate(HullType newtype) else if (type_ == hullEqnArray) { if (newtype < type_) { - // set correct (no)numbering - nonum_[0] = true; - for (row_type row = 0; row < nrows(); ++row) { - if (!nonum_[row]) { - nonum_[0] = false; - break; - } - } - // set first non-empty label for (row_type row = 0; row < nrows(); ++row) { if (label_[row]) { @@ -1058,8 +1056,7 @@ void InsetMathHull::mutate(HullType newtype) break; } } - - glueall(); + glueall(newtype); mutate(newtype); } else { // align & Co. changeCols(2); diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index eba5c5199d..8305c72a7d 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -187,7 +187,7 @@ private: /// void doExtern(Cursor & cur, FuncRequest & func); /// - void glueall(); + void glueall(HullType type); /*! * split every row at the first relation operator. * The number of columns must be 1. One column is added.