setAutoBreakRows(true);
setDrawFrame(true);
setFrameColor(Color_collapsableframe);
- setButtonLabel();
- // Fallback for lacking inset layout item
- layout_.bgcolor = Color_background;
}
void InsetCollapsable::setLayout(BufferParams const & bp)
{
+ // FIXME: put this in the InsetLayout parsing?
+ // Fallback for lacking inset layout background
+ layout_.bgcolor = Color_background;
+
layout_ = getLayout(bp);
+
+ // FIXME: put this in the InsetLayout parsing?
+ layout_.labelfont.realize(sane_font);
+
+ setButtonLabel();
}
if (!token_found)
status_ = isOpen() ? Open : Collapsed;
- setButtonLabel();
+ setLayout(buf.params());
// Force default font, if so requested
// This avoids paragraphs in buffer language that would have a
autoOpen_ = mi.base.bv->cursor().isInside(this);
FontInfo tmpfont = mi.base.font;
- getDrawFont(mi.base.font);
+ mi.base.font = layout_.font;
mi.base.font.realize(tmpfont);
switch (geometry()) {
dim.des = max(dim.des - textdim.asc + dim.asc, textdim.des);
dim.asc = textdim.asc;
} else {
- dim.des += textdim.height() + TEXT_TO_BOTTOM_OFFSET;
+ dim.des += textdim.height() + TEXT_TO_INSET_OFFSET;
dim.wid = max(dim.wid, textdim.wid);
}
}
pi.background_color = backgroundColor();
FontInfo tmpfont = pi.base.font;
- getDrawFont(pi.base.font);
+ pi.base.font = layout_.font;
pi.base.font.realize(tmpfont);
// Draw button first -- top, left or only
}
-void InsetCollapsable::getDrawFont(FontInfo & font) const
-{
- font = layout_.font;
-}
-
-
bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
}
-void InsetCollapsable::setLabelFont(FontInfo const & font)
-{
- layout_.labelfont = font;
-}
-
docstring InsetCollapsable::floatName(string const & type, BufferParams const & bp) const
{
FloatList const & floats = bp.getTextClass().floats();
if (!layout_.latexname.empty()) {
if (layout_.latextype == "command") {
// FIXME UNICODE
+ if (runparams.moving_arg)
+ os << "\\protect";
os << '\\' << from_utf8(layout_.latexname);
if (!layout_.latexparam.empty())
os << from_utf8(layout_.latexparam);
OutputParams rp = runparams;
if (layout_.passthru)
rp.verbatim = true;
+ if (layout_.needprotect)
+ rp.moving_arg = true;
int i = InsetText::latex(buf, os, rp);
if (!layout_.latexname.empty()) {
if (layout_.latextype == "command") {