- tmacro_->update();
- if (opened_) {
- tmacro_->setEditMode(true);
- InsetFormula::draw(bv, font, baseline, x, cleared);
- tmacro_->setEditMode(false);
- } else {
- font.setColor(LColor::math);
-
- int const y = baseline - ascent(bv, font) + 1;
- int const w = width(bv, font) - 2;
- int const h = (ascent(bv, font) + descent(bv, font) - 2);
-
- pain.fillRectangle(int(x), y, w, h, LColor::mathbg);
- pain.rectangle(int(x), y, w, h, LColor::mathframe);
-
- string s(_("Macro: "));
- s += name_;
- pain.text(int(x + 2), baseline, s, font);
- x += width(bv, font) - 1;
- }
-}
-
-
-string const InsetFormulaMacro::EditMessage() const
-{
- return _("Math macro editor mode");
-}
-
-
-void InsetFormulaMacro::Edit(BufferView * bv, int x, int y,unsigned int button)
-{
- opened_ = true;
- par = static_cast<MathParInset*>(tmacro_->Clone());
- InsetFormula::Edit(bv, x, y, button);
-}
-
-
-void InsetFormulaMacro::InsetUnlock(BufferView * bv)
-{
- opened_ = false;
- tmacro_->setData(par->GetData());
- tmacro_->setEditMode(false);
- InsetFormula::InsetUnlock(bv);
-}
-
-
-UpdatableInset::RESULT
-InsetFormulaMacro::LocalDispatch(BufferView * bv,
- kb_action action, string const & arg)
-{
- if (action == LFUN_MATH_MACROARG) {
- int const i = lyx::atoi(arg) - 1;
- if (i >= 0 && i < tmacro_->getNoArgs()) {
- mathcursor->insertInset(tmacro_->getMacroPar(i),
- LM_TC_INSET);
- InsetFormula::UpdateLocal(bv);
- }
-
- return DISPATCHED;
- }
- tmacro_->setEditMode(true);
- tmacro_->Metrics();
- RESULT result = InsetFormula::LocalDispatch(bv, action, arg);
- tmacro_->setEditMode(false);
-
- return result;
+
+ // label
+ font.setColor(LColor::math);
+
+ int const x = int(xx);
+ int const a = y - ascent(bv, font) + 1;
+ int const w = width(bv, font) - 2;
+ int const h = ascent(bv, font) + descent(bv, font) - 2;
+
+ // LColor::mathbg used to be "AntiqueWhite" but is "linen" now, too
+ pain.pain.fillRectangle(x, a, w, h, LColor::mathmacrobg);
+ pain.pain.rectangle(x, a, w, h, LColor::mathframe);
+
+ if (mathcursor &&
+ const_cast<InsetFormulaBase const *>(mathcursor->formula()) == this)
+ mathcursor->drawSelection(pain);
+
+ pain.pain.text(x + 2, y, prefix(), font);
+
+ // formula
+ par()->draw(pain, x + font_metrics::width(prefix(), f) + 5, y);
+ xx += w + 2;
+ xo_ = x;
+ yo_ = y;
+
+ setCursorVisible(false);