+namespace {
+
+void drawMarkers(PainterInfo const & pi, MathRow::Element const & e, int const x, int const y)
+{
+ if (e.marker == InsetMath::NO_MARKER)
+ return;
+
+ CoordCache const & coords = pi.base.bv->coordCache();
+ Dimension const dim = coords.getInsets().dim(e.inset);
+
+ // the marker is before/after the inset. Normally some space has been reserved already.
+ int const l = x + e.before - 1;
+ int const r = x + dim.width() - e.after;
+
+ // Duplicated from Inset.cpp and adapted. It is believed that the
+ // Inset version should die eventually
+ ColorCode pen_color = e.inset->mouseHovered(pi.base.bv) || e.inset->editing(pi.base.bv)?
+ Color_mathframe : Color_mathcorners;
+
+ int const d = y + dim.descent();
+ pi.pain.line(l, d - 3, l, d, pen_color);
+ pi.pain.line(r, d - 3, r, d, pen_color);
+ pi.pain.line(l, d, l + 3, d, pen_color);
+ pi.pain.line(r - 3, d, r, d, pen_color);
+
+ if (e.marker == InsetMath::MARKER)
+ return;
+
+ int const a = y - dim.ascent();
+ pi.pain.line(l, a + 3, l, a, pen_color);
+ pi.pain.line(r, a + 3, r, a, pen_color);
+ pi.pain.line(l, a, l + 3, a, pen_color);
+ pi.pain.line(r - 3, a, r, a, pen_color);
+}
+
+}
+