]> git.lyx.org Git - features.git/commit
It used to be that things like InsetFlex, InsetCaption, and the like used the default...
authorRichard Heck <rgheck@comcast.net>
Tue, 19 Feb 2008 02:35:07 +0000 (02:35 +0000)
committerRichard Heck <rgheck@comcast.net>
Tue, 19 Feb 2008 02:35:07 +0000 (02:35 +0000)
commit7dcffe09f42c7f2b17c018ba69c53e1fd6b00c46
treee95dcfb3a5fe2b5185de1c1f6a8cbf5726bb91d1
parent85c0bf5e165b14dfe7a81a815ebc16e27551b684
It used to be that things like InsetFlex, InsetCaption, and the like used the default layout, whatever that is---usually Standard. That gave rise to bug 2178, the solution to which is to define a new empty layout, which insets like these use instead of the default. See r22966.

So, when we have an older LyX file, it will look like this:
\begin_inset ERT
status open

\begin_layout Standard

this that
\end_layout

\end_inset
which is now invalid, because ERT uses only PlainLayout. So I had put some code into Text::readParToken, where the layout for a paragraph gets set as it is read:
       if (par.forceEmptyLayout()) {
           // in this case only the empty layout is allowed
           layoutname = tclass.emptyLayoutName();
       } else if (par.useEmptyLayout()) {
           // in this case, default layout maps to empty layout
           if (layoutname == tclass.defaultLayoutName())
               layoutname = tclass.emptyLayoutName();
       } else {
           // otherwise, the empty layout maps to the default
           if (layoutname == tclass.emptyLayoutName())
               layoutname = tclass.defaultLayoutName();
       }
This turns out not to work, because par.forceEmptyLayout() and par.useEmptyLayout() always return false here, because par.inInset() always returns a null pointer, because the paragraph's inset hasn't yet been set when Text::readParagraph() gets called from Text::read() gets called from InsetText::read(). The solution is to set the paragraph's inset when it is created, which means passing a pointer to the various read() routines along the way.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23057 a592a061-630c-0410-9148-cb99ea01b6c8
src/Buffer.cpp
src/Text.cpp
src/Text.h
src/insets/InsetText.cpp
src/insets/InsetText.h
src/paragraph_funcs.cpp