]> git.lyx.org Git - features.git/commitdiff
Fix bug #6793: Changing an existing formula type to displayed formula loses the label
authorEnrico Forestieri <forenr@lyx.org>
Thu, 19 Aug 2010 13:58:36 +0000 (13:58 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Thu, 19 Aug 2010 13:58:36 +0000 (13:58 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35178 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h

index c12abd1c92c77ec3e1f127477e6b0bbf93579ccd..930f848a30a8262a49bebbffa336bab68498f204 100644 (file)
@@ -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);
index eba5c5199dfc4379f4a92972fd2add12b9947e6b..8305c72a7dd235965a8fff15f6bf34a3cf5f7278 100644 (file)
@@ -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.