fix the NEW_INSETS end_deeper prob

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@911 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-07-21 14:59:00 +00:00
parent 539226ab29
commit f23a147fe1
3 changed files with 41 additions and 11 deletions

View File

@ -1,3 +1,12 @@
2000-07-21 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/paragraph.C (SimpleTeXOnePar): NEW_INSETS: move some #ifdef
to correct place.
* src/buffer.C (parseSingleLyXformat2Token: NEW_INSETS: fix the
planemet in reading of old style floats, fix the \end_deeper
problem when reading old style floats.
2000-07-20 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/paragraph.C (writeFile): NEW_INSETS: move a misplaced #endif

View File

@ -404,6 +404,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
//lyxerr << "old float: " << tmptok << endl;
Inset * inset = 0;
string old_float;
if (tmptok == "footnote") {
inset = new InsetFoot;
@ -411,31 +412,53 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
inset = new InsetMarginal;
} else if (tmptok == "fig") {
inset = new InsetFloat("figure");
//inset = new InsetFigure;
old_float += "placement htbp\n";
} else if (tmptok == "tab") {
inset = new InsetFloat("table");
//inset = new InsetTable;
old_float += "placement htbp\n";
} else if (tmptok == "alg") {
inset = new InsetFloat("algorithm");
//inset = new InsetAlgorithm;
old_float += "placement htbp\n";
} else if (tmptok == "wide-fig") {
InsetFloat * tmp = new InsetFloat("figure");
tmp->wide(true);
inset = tmp;
//inset = new InsetFigure(true);
old_float += "placement htbp\n";
} else if (tmptok == "wide-tab") {
InsetFloat * tmp = new InsetFloat("table");
tmp->wide(true);
inset = tmp;
//inset = new InsetTable(true);
old_float += "placement htbp\n";
}
if (!inset) return false; // no end read yet
string old_float = "\ncollapsed true\n";
old_float += "collapsed true\n";
// Here we need to check for \end_deeper and handle that
// before we do the footnote parsing.
// This _is_ a hack! (Lgb)
while(true) {
lex.next();
string tmp = lex.GetString();
if (tmp == "\\end_deeper") {
lyxerr << "\\end_deeper caught!" << endl;
if (!depth) {
lex.printError("\\end_deeper: "
"depth is already null");
} else
--depth;
} else {
old_float += tmp;
old_float += ' ';
break;
}
}
old_float += lex.getLongString("\\end_float");
old_float += "\n\\end_inset\n";
lyxerr << "float body: " << old_float << endl;
//lyxerr << "float body: " << old_float << endl;
#ifdef HAVE_SSTREAM
istringstream istr(old_float.c_str());

View File

@ -2576,17 +2576,15 @@ bool LyXParagraph::SimpleTeXOnePar(Buffer const * buf,
// Fully instantiated font
LyXFont font = getFont(bparams, i);
#ifndef NEW_INSETS
LyXParagraph * p = 0;
if (i == 0
#ifndef NEW_INSETS
&& previous &&
previous->footnoteflag != LyXParagraph::NO_FOOTNOTE &&
(p = PreviousBeforeFootnote()) != 0)
#else
&& (p = previous))
#endif
last_font = p->getFont(bparams, p->size() - 1);
else
#endif
last_font = running_font;
// Spaces at end of font change are simulated to be