setButtonLabel();
}
+int InsetCollapsible::topOffset(BufferView const * bv) const
+{
+ switch (geometry(*bv)) {
+ case Corners:
+ case SubLabel:
+ return 0;
+ default:
+ return InsetText::topOffset(bv);
+ }
+}
+
+int InsetCollapsible::bottomOffset(BufferView const * bv) const
+{
+ switch (geometry(*bv)) {
+ case Corners:
+ case SubLabel:
+ return InsetText::bottomOffset(bv) / 4;
+ default:
+ return InsetText::bottomOffset(bv);
+ }
+}
+
Dimension InsetCollapsible::dimensionCollapsed(BufferView const & bv) const
{
FontInfo labelfont(getLabelfont());
labelfont.realize(sane_font);
theFontMetrics(labelfont).buttonText(
- buttonLabel(bv), TEXT_TO_INSET_OFFSET, dim.wid, dim.asc, dim.des);
+ buttonLabel(bv), Inset::textOffset(&bv), dim.wid, dim.asc, dim.des);
return dim;
}
break;
case Corners:
InsetText::metrics(mi, dim);
- dim.des -= 3;
- dim.asc -= 1;
break;
case SubLabel: {
InsetText::metrics(mi, dim);
dim.des = max(dim.des - textdim.asc + dim.asc, textdim.des);
dim.asc = textdim.asc;
} else {
- dim.des += textdim.height() + TEXT_TO_INSET_OFFSET;
+ dim.des += textdim.height() + topOffset(mi.base.bv);
dim.wid = max(dim.wid, textdim.wid);
}
}
labelfont.realize(pi.base.font);
pi.pain.buttonText(x, y, buttonLabel(bv), labelfont,
view_[&bv].mouse_hover_ ? Color_buttonhoverbg : Color_buttonbg,
- Color_buttonframe, TEXT_TO_INSET_OFFSET);
+ Color_buttonframe, Inset::textOffset(pi.base.bv));
// Draw the change tracking cue on the label, unless RowPainter already
// takes care of it.
if (canPaintChange(bv))
}
int desc = textdim.descent();
- if (g == Corners)
- desc -= 3;
// Colour the frame according to the change type. (Like for tables.)
Color colour = pi.change.changed() ? pi.change.color()
: Color_foreground;
- const int xx1 = x + TEXT_TO_INSET_OFFSET - 1;
- const int xx2 = x + textdim.wid - TEXT_TO_INSET_OFFSET + 1;
+ const int xx1 = x + leftOffset(pi.base.bv) - 1;
+ const int xx2 = x + textdim.wid - rightOffset(pi.base.bv) + 1;
pi.pain.line(xx1, y + desc - 4,
xx1, y + desc, colour);
if (status_ == Open)
int w = 0;
int a = 0;
int d = 0;
- Color const col = pi.full_repaint ? Color_none : pi.backgroundColor(this);
+ Color const col = pi.full_repaint ? Color_none : pi.backgroundColor();
theFontMetrics(font).rectText(buttonLabel(bv), w, a, d);
int const ww = max(textdim.wid, w);
pi.pain.rectText(x + (ww - w) / 2, y + desc + a,