- tmacro->update();
- if (opened) {
- tmacro->setEditMode(true);
- InsetFormula::draw(pain, font, baseline, x);
- tmacro->setEditMode(false);
- } else {
- font.setColor(LColor::math);
-
- int y = baseline - ascent(pain, font) + 1;
- int w = width(pain, font) - 2;
- int h = (ascent(pain, font) + descent(pain, 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(pain, font) - 1;
- }
-}
-
-
-void InsetFormulaMacro::Edit(int x, int y)
-{
- opened = true;
- par = static_cast<MathParInset*>(tmacro->Clone());
- InsetFormula::Edit(x, y);
-}
-
-
-void InsetFormulaMacro::InsetUnlock()
-{
- opened = false;
- LyxArrayBase * tarray = tmacro->GetData();
- MathedIter it(tarray);
- it.Clear();
- tmacro->SetData(par->GetData());
- tmacro->setEditMode(false);
- InsetFormula::InsetUnlock();
-}
-
-
-bool InsetFormulaMacro::LocalDispatch(int action, char const * arg)
-{
- if (action == LFUN_MATH_MACROARG) {
- int i = atoi(arg) - 1;
- if (i >= 0 && i < tmacro->getNoArgs()) {
- mathcursor->Insert(tmacro->getMacroPar(i), LM_TC_INSET);
- InsetFormula::UpdateLocal();
- }
-
- return true;
- }
- tmacro->setEditMode(true);
- tmacro->Metrics();
- bool result = InsetFormula::LocalDispatch(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);