]> git.lyx.org Git - features.git/commitdiff
Linearize macros also when editing them
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 1 Feb 2017 10:53:23 +0000 (11:53 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 1 Feb 2017 11:21:15 +0000 (12:21 +0100)
In the case of inline editing, this avoids unpleasant jumping issues.

This may requires to enter monochrome mode before painting the macro
elements.

src/mathed/MathMacro.cpp
src/mathed/MathRow.cpp

index 3502d1dfc50091378b0e24602e5f39f829d4f9ce..d06813f57df318d5588a4041c3aedcd024deb7a0 100644 (file)
@@ -303,8 +303,12 @@ bool MathMacro::addToMathRow(MathRow & mrow, MetricsInfo & mi) const
        // This is the same as what is done in metrics().
        d->editing_[mi.base.bv] = editMode(mi.base.bv);
 
+       // For now we do not linearize in the following cases (can be improved)
+       // - display mode different from normal
+       // - editing with parameter list
+       // - editing with box around macro
        if (displayMode() != MathMacro::DISPLAY_NORMAL
-           || d->editing_[mi.base.bv])
+               || (d->editing_[mi.base.bv] && lyxrc.macro_edit_style != LyXRC::MACRO_EDIT_INLINE))
                return InsetMath::addToMathRow(mrow, mi);
 
        /// The macro nesting can change display of insets. Change it locally.
index 0c6995a90e57c13bfb3e68820e5256df40aa4275..0f4e654827cca774d66f2dcf4969da3500bb4047 100644 (file)
@@ -276,8 +276,13 @@ void MathRow::draw(PainterInfo & pi, int x, int const y) const
                }
                case BEG_MACRO:
                        coords.insets().add(e.macro, x, y);
-
                        drawMarkers(pi, e, x, y);
+                       if (e.macro->editMetrics(pi.base.bv))
+                               pi.pain.enterMonochromeMode(Color_mathbg, Color_mathmacroblend);
+                       break;
+               case END_MACRO:
+                       if (e.macro->editMetrics(pi.base.bv))
+                               pi.pain.leaveMonochromeMode();
                        break;
                case BEG_ARG:
                        coords.arrays().add(e.ar, x, y);
@@ -300,7 +305,6 @@ void MathRow::draw(PainterInfo & pi, int x, int const y) const
                        break;
                }
                case DUMMY:
-               case END_MACRO:
                        break;
                }