- InsetCollapsable(): Move labelfont initialisation to InsetCollapsable::setLayout().
- read(): reset the inset layout.
All other insets: get rid of redundant setLayout() calls.
This commit fixes the multiple crashes in trunk but the color used for text and background are completely wrong...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21382
a592a061-630c-0410-9148-
cb99ea01b6c8
InsetBox::InsetBox(BufferParams const & bp, string const & label)
: InsetCollapsable(bp), params_(label)
{
- setLayout(bp);
init();
}
{
params_.read(lex);
InsetCollapsable::read(buf, lex);
- setLayout(buf.params());
setButtonLabel();
}
InsetBranchParams const & params)
: InsetCollapsable(bp), params_(params)
{
- setLayout(bp);
init();
}
{
params_.read(lex);
InsetCollapsable::read(buf, lex);
- setLayout(buf.params());
- setButtonLabel();
}
InsetBranchMailer::string2params(to_utf8(cmd.argument()), params);
params_.branch = params.branch;
setLayout(cur.buffer().params());
- setButtonLabel();
break;
}
setDrawFrame(true);
setFrameColor(Color_collapsableframe);
setButtonLabel();
- // Fallback for lacking inset layout item
- layout_.bgcolor = Color_background;
-
- // FIXME: it seems some insets don't properly initialise that!
- layout_.labelfont = sane_font;
- layout_.labelfont.decSize();
- layout_.labelfont.decSize();
- layout_.labelfont.setColor(Color_collapsable);
+ setLayout(bp);
}
void InsetCollapsable::setLayout(BufferParams const & bp)
{
+ // Fallback for lacking inset layout item
+ layout_.bgcolor = Color_background;
+
+ // FIXME: it seems the default background is red!
layout_ = getLayout(bp);
+
+
+ // FIXME: it seems the provided font is partly realized... so we
+ // re-initialize the label font in any case.
+ /*
+ if (layout_.labelfont != inherit_font)
+ return;
+ */
+
+ // FIXME: it seems some insets don't properly initialise that...
+ layout_.labelfont = sane_font;
+ layout_.labelfont.decSize();
+ layout_.labelfont.decSize();
+ layout_.labelfont.setColor(Color_collapsable);
}
status_ = isOpen() ? Open : Collapsed;
setButtonLabel();
+ setLayout(buf.params());
// Force default font, if so requested
// This avoids paragraphs in buffer language that would have a
InsetERT::InsetERT(BufferParams const & bp, CollapseStatus status)
: InsetCollapsable(bp, status)
{
- setLayout(bp);
init();
}
InsetFoot::InsetFoot(BufferParams const & bp)
: InsetFootlike(bp)
-{
- setLayout(bp);
-}
+{}
InsetFoot::InsetFoot(InsetFoot const & in)
InsetIndex::InsetIndex(BufferParams const & bp)
: InsetCollapsable(bp)
-{
- setLayout(bp);
-}
+{}
InsetIndex::InsetIndex(InsetIndex const & in)
InsetListings::InsetListings(BufferParams const & bp, InsetListingsParams const & par)
: InsetCollapsable(bp, par.status())
{
- setLayout(bp);
init();
}
InsetMarginal::InsetMarginal(BufferParams const & bp)
: InsetFootlike(bp)
-{
- setLayout(bp);
-}
+{}
InsetMarginal::InsetMarginal(InsetMarginal const & in)
: InsetCollapsable(bp)
{
params_.type = notetranslator().find(label);
- setLayout(bp);
setButtonLabel();
}
{
params_.read(lex);
InsetCollapsable::read(buf, lex);
- setLayout(buf.params());
- setButtonLabel();
}
InsetNoteMailer::string2params(to_utf8(cmd.argument()), params_);
// get a bp from cur:
setLayout(cur.buffer().params());
- setButtonLabel();
break;
case LFUN_INSET_DIALOG_UPDATE: