Linearize macros also when editing them

In the case of inline editing, this avoids unpleasant jumping issues.

This may requires to enter monochrome mode before painting the macro
elements.
This commit is contained in:
Jean-Marc Lasgouttes 2017-02-01 11:53:23 +01:00
parent 602b858eee
commit f86dacc292
2 changed files with 11 additions and 3 deletions

View 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.

View 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;
}