void afterDraw(PainterInfo const & pi) const
{
if (mathMacro_->editMetrics(pi.base.bv))
- pi.pain.enterMonochromeMode(Color_mathbg, Color_mathmacroblend);
+ pi.pain.enterMonochromeMode(Color_mathmacroblend);
}
///
void metrics(MetricsInfo &, Dimension &) const {
return has_contents;
}
+/// Whether the inset allows \(no)limits
+bool InsetMathMacro::allowsLimitsChange() const
+{
+ // similar to the code in mathClass(), except that we search for
+ // the right-side class.
+ MathClass mc = MC_UNKNOWN;
+ if (MacroData const * m = macroBackup()) {
+ // If it is a global macro and is defined explicitly
+ if (m->symbol())
+ mc = string_to_class(m->symbol()->extra);
+ }
+ // Otherwise guess from the expanded macro
+ if (mc == MC_UNKNOWN)
+ mc = d->expanded_.lastMathClass();
+
+ return mc == MC_OP;
+}
+
+
+Limits InsetMathMacro::defaultLimits() const
+{
+ if (d->expanded_.empty())
+ return NO_LIMITS;
+ // Guess from the expanded macro
+ InsetMath const * in = d->expanded_.back().nucleus();
+ Limits const lim = in->limits() == AUTO_LIMITS
+ ? in->defaultLimits() : in->limits();
+ LATTEST(lim != AUTO_LIMITS);
+ return lim;
+}
+
+
void InsetMathMacro::beforeMetrics() const
{
d->macro_->lock();
void InsetMathMacro::beforeDraw(PainterInfo const & pi) const
{
if (d->editing_[pi.base.bv])
- pi.pain.enterMonochromeMode(Color_mathbg, Color_mathmacroblend);
+ pi.pain.enterMonochromeMode(Color_mathmacroblend);
}
pi.pain.text(x, y, from_ascii(":"), labelFont);
x += strw2;
- // draw paramter
+ // draw parameter
cell(i).draw(pi, x, y);
// next line
// add space if there was no argument
if (first)
os.pendingSpace(true);
+
+ // write \(no)limits modifiers if relevant
+ writeLimits(os);
}
// macro_ is 0 if this is an unknown macro
LATTEST(d->macro_ || d->displayMode_ != DISPLAY_NORMAL);
if (d->macro_) {
- docstring const xmlname = d->macro_->xmlname();
+ docstring const xmlname = (ms.xmlMode()) ? d->macro_->xmlname() : d->macro_->htmlname();
if (!xmlname.empty()) {
char const * type = d->macro_->MathMLtype();
ms << "<" << from_ascii(ms.namespacedTag(type)) << ">"
// macro_ is 0 if this is an unknown macro
LATTEST(d->macro_ || d->displayMode_ != DISPLAY_NORMAL);
if (d->macro_) {
- docstring const xmlname = d->macro_->xmlname();
+ docstring const xmlname = d->macro_->htmlname();
if (!xmlname.empty()) {
os << ' ' << xmlname << ' ';
return;