There's a bug in the code that sets the layout for the first paragraph
of an InsetCollapsable. If you start LyX from a terminal and create a
branch, you'll see some error messages about PlainLayout not being
found. This is because the first paragraph is being set to PlainLayout
in the InsetCollapsable constructor, whereas InsetBranch takes Standard.
I don't know how this wasn't picked up before.
Anyway, the attached patch seems to solve the problem. Probably we
should be doing this here anyway, rather than
I tried just doing this:
Index: insets/InsetCollapsable.cpp
===================================================================
--- insets/InsetCollapsable.cpp (revision 27110)
+++ insets/InsetCollapsable.cpp (working copy)
@@ -86,7 +86,7 @@
setAutoBreakRows(true);
setDrawFrame(true);
setFrameColor(Color_collapsableframe);
- paragraphs().back().setLayout(dc.plainLayout());
+ paragraphs().back().setPlainOrDefaultLayout(dc);
}
but that doesn't work, because we end up calling the virtual function
usePlainLayout() somewhere along the way, and of course that does the
wrong thing.
In fact, I guess I must have put the setLayout() line there in the first
place due to the same problem elsewhere: There's a call to
setPlainOrDefaultLayout() in InsetText::initParagraphs() already. But it
does the wrong thing when called from the InsetText constructor. So that
was always wrong.
OK to commit? Are there any other ways an InsetText might be created
that we would also need to do this kind of thing? Copies and the like
aren't an issue. But really, the right place to do this would be the
InsetText constructor. Is there a better way around the "Can't call
virtual functions in a constructor" problem?
rh
Index: insets/InsetCollapsable.cpp
===================================================================
--- insets/InsetCollapsable.cpp (revision 27110)
+++ insets/InsetCollapsable.cpp (working copy)
@@ -86,7 +86,6 @@
setAutoBreakRows(true);
setDrawFrame(true);
setFrameColor(Color_collapsableframe);
- paragraphs().back().setLayout(dc.plainLayout());
}
Index: Text3.cpp
===================================================================
--- Text3.cpp (revision 27110)
+++ Text3.cpp (working copy)
@@ -207,6 +207,9 @@
if (!inset)
return false;
+ if (InsetText * ti = inset->asInsetText())
+ ti->text().paragraphs().front().
+ setPlainOrDefaultLayout(bparams.documentClass());
if (InsetCollapsable * ci = inset->asInsetCollapsable())
ci->setLayout(bparams);