- pi.pain.line(x + 2, y + inset.descent() - 4, x + 2,
- y + inset.descent(), params_.labelfont.color());
- pi.pain.line(x + 2, y + inset.descent(), x + dim_.wid - 2,
- y + inset.descent(), params_.labelfont.color());
- pi.pain.line(x + dim_.wid - 2, y + inset.descent(), x + dim_.wid - 2,
- y + inset.descent() - 4, params_.labelfont.color());
-
- if (has_label_) {
- if (!owner())
- x += scroll();
-
- LyXFont font(params_.labelfont);
- font.realize(LyXFont(LyXFont::ALL_SANE));
- font.decSize();
- font.decSize();
- int w = 0;
- int a = 0;
- int d = 0;
- font_metrics::rectText(params_.type, font, w, a, d);
- pi.pain.rectText(x + 0.5 * (dim_.wid - w),
- y + inset.descent() + a,
- params_.type, font, LColor::none, LColor::none);
+ int desc = InsetText::descent();
+ if (params_.show_label)
+ desc -= ascent();
+
+ pi.pain.line(x, y + desc - 4, x, y + desc, params_.labelfont.color());
+ pi.pain.line(x, y + desc, x + dim_.wid - 3, y + desc,
+ params_.labelfont.color());
+ pi.pain.line(x + dim_.wid - 3, y + desc, x + dim_.wid - 3, y + desc - 4,
+ params_.labelfont.color());
+
+ // the name of the charstyle. Can be toggled.
+ if (params_.show_label) {
+ LyXFont font(params_.labelfont);
+ font.realize(LyXFont(LyXFont::ALL_SANE));
+ font.decSize();
+ font.decSize();
+ int w = 0;
+ int a = 0;
+ int d = 0;
+ // FIXME UNICODE
+ docstring s(from_utf8(params_.type));
+ if (undefined())
+ s = _("Undef: ") + s;
+ theFontMetrics(font).rectText(s, w, a, d);
+ pi.pain.rectText(x + (dim_.wid - w) / 2, y + desc + a,
+ s, font, LColor::none, LColor::none);
+ }
+
+ // a visual clue when the cursor is inside the inset
+ LCursor & cur = pi.base.bv->cursor();
+ if (cur.isInside(this)) {
+ y -= ascent();
+ pi.pain.line(x, y + 4, x, y, params_.labelfont.color());
+ pi.pain.line(x + 4, y, x, y, params_.labelfont.color());
+ pi.pain.line(x + dim_.wid - 3, y + 4, x + dim_.wid - 3, y,
+ params_.labelfont.color());
+ pi.pain.line(x + dim_.wid - 7, y, x + dim_.wid - 3, y,
+ params_.labelfont.color());