]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathHull.cpp
Fix assertion when checking if change in selection
[lyx.git] / src / mathed / InsetMathHull.cpp
index 1c40a72e0f6542044db00e69435f80fb489d1d73..582685e4f968a512b383a13958194b16811e05c8 100644 (file)
@@ -430,7 +430,7 @@ InsetMath::mode_type InsetMathHull::currentMode() const
 // alignment is not implemented in the LyXHTML output.
 char InsetMathHull::defaultColAlign(col_type col)
 {
-       return colAlign(type_, col);
+       return colAlign(type_, col, buffer().params());
 }
 
 
@@ -452,7 +452,7 @@ char InsetMathHull::displayColAlign(idx_type idx) const
        case hullXAlignAt:
        case hullXXAlignAt:
        case hullFlAlign:
-               return colAlign(type_, col(idx));
+               return colAlign(type_, col(idx), buffer().params());
        default:
                break;
        }
@@ -540,7 +540,7 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const
                        // insert a gap in front of the formula
                        // value was hardcoded to 1 pixel
                        dim.wid += mi.base.bv->zoomedPixels(1) ;
-                       if (display() != Inline) {
+                       if (display()) {
                                dim.asc += display_margin;
                                dim.des += display_margin;
                        }
@@ -549,13 +549,13 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const
        }
 
        Changer dummy1 = mi.base.changeFontSet(standardFont());
-       Changer dummy2 = mi.base.font.changeStyle(display() != Inline ? LM_ST_DISPLAY
+       Changer dummy2 = mi.base.font.changeStyle(display() ? LM_ST_DISPLAY
                                                            : LM_ST_TEXT);
 
        // let the cells adjust themselves
        InsetMathGrid::metrics(mi, dim);
 
-       if (display() != Inline) {
+       if (display()) {
                dim.asc += display_margin;
                dim.des += display_margin;
        }
@@ -653,7 +653,7 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
        Changer dummy0 = really_change_color ? pi.base.font.changeColor(color)
                : Changer();
        Changer dummy1 = pi.base.changeFontSet(standardFont());
-       Changer dummy2 = pi.base.font.changeStyle(display() != Inline ? LM_ST_DISPLAY
+       Changer dummy2 = pi.base.font.changeStyle(display() ? LM_ST_DISPLAY
                                                            : LM_ST_TEXT);
 
        int xmath = x;
@@ -695,7 +695,7 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
 
 void InsetMathHull::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
 {
-       if (display() != Inline) {
+       if (display()) {
                InsetMathGrid::metricsT(mi, dim);
        } else {
                odocstringstream os;
@@ -711,7 +711,7 @@ void InsetMathHull::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
 
 void InsetMathHull::drawT(TextPainter & pain, int x, int y) const
 {
-       if (display() != Inline) {
+       if (display()) {
                InsetMathGrid::drawT(pain, x, y);
        } else {
                odocstringstream os;
@@ -1022,12 +1022,12 @@ Inset::DisplayType InsetMathHull::display() const
        case hullMultline:
        case hullGather:
                if (buffer().params().is_math_indent)
-                       return Display | AlignLeft;
+                       return AlignLeft;
                else
-                       return Display;
+                       return AlignCenter;
        }
        // avoid warning
-       return Display;
+       return AlignCenter;
 }
 
 
@@ -1295,8 +1295,8 @@ void InsetMathHull::addRow(row_type row)
        if (type_ == hullMultline) {
                if (row + 1 == nrows())  {
                        numbered_[row] = NONUMBER;
-                       std::swap(label, label_[row]);
-                       std::swap(number, numbers_[row]);
+                       swap(label, label_[row]);
+                       swap(number, numbers_[row]);
                } else
                        numbered = false;
        }
@@ -1314,9 +1314,9 @@ void InsetMathHull::swapRow(row_type row)
                return;
        if (row + 1 == nrows())
                --row;
-       std::swap(numbered_[row], numbered_[row + 1]);
-       std::swap(numbers_[row], numbers_[row + 1]);
-       std::swap(label_[row], label_[row + 1]);
+       swap(numbered_[row], numbered_[row + 1]);
+       swap(numbers_[row], numbers_[row + 1]);
+       swap(label_[row], label_[row + 1]);
        InsetMathGrid::swapRow(row);
 }
 
@@ -1326,9 +1326,9 @@ void InsetMathHull::delRow(row_type row)
        if (nrows() <= 1 || !rowChangeOK())
                return;
        if (row + 1 == nrows() && type_ == hullMultline) {
-               std::swap(numbered_[row - 1], numbered_[row]);
-               std::swap(numbers_[row - 1], numbers_[row]);
-               std::swap(label_[row - 1], label_[row]);
+               swap(numbered_[row - 1], numbered_[row]);
+               swap(numbers_[row - 1], numbers_[row]);
+               swap(label_[row - 1], label_[row]);
                InsetMathGrid::delRow(row);
                return;
        }
@@ -2324,7 +2324,7 @@ int InsetMathHull::plaintext(odocstringstream & os,
         OutputParams const & op, size_t max_length) const
 {
        // Try enabling this now that there is a flag as requested at #2275.
-       if (buffer().isExporting() && display() != Inline) {
+       if (buffer().isExporting() && display()) {
                Dimension dim;
                TextMetricsInfo mi;
                metricsT(mi, dim);