Fix bugs in minipage compatibility read (fix #240).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3681 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2002-03-06 16:02:51 +00:00
parent dff5ba1d99
commit ff8f704031
5 changed files with 33 additions and 7 deletions

View File

@ -1,3 +1,13 @@
2002-03-06 Juergen Vigna <jug@sad.it>
* buffer.C (parseSingleLyXformat2Token): changed "%" to "p%" as
otherwise it would not be a valid lenght. Fixed a special case in
the minipage compatibility read where we end the document with a
minipage.
* text2.C (deleteEmptyParagraphMechanism): check if old_cursor.par()
was set as it could be 0 for InsetTexts first entry.
2002-03-06 Lars Gullik Bjønnes <larsbj@birdstep.com>
* paragraph.C (writeFile): if layout is empty write out

View File

@ -433,7 +433,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
static int call_depth;
++call_depth;
bool checkminipage = false;
static Paragraph * minipar;
static Paragraph * minipar = 0;
static Paragraph * parBeforeMinipage;
#endif
#endif
@ -1172,6 +1172,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
the_end_read = true;
#ifndef NO_COMPABILITY
#ifndef NO_PEXTRA_REALLY
if (minipar == par)
par = 0;
minipar = parBeforeMinipage = 0;
#endif
#endif
@ -1228,7 +1230,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
if (checkminipage && (call_depth == 1)) {
checkminipage = false;
if (minipar && (minipar != par) &&
(par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE)) {
(par->params().pextraType() == Paragraph::PEXTRA_MINIPAGE))
{
lyxerr << "minipages in a row" << endl;
if (par->params().pextraStartMinipage()) {
lyxerr << "start new minipage" << endl;
@ -1264,7 +1267,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
mini->pageWidth(LyXLength(par->params().pextraWidth()));
if (!par->params().pextraWidthp().empty()) {
lyxerr << "WP:" << mini->pageWidth().asString() << endl;
mini->pageWidth(LyXLength((par->params().pextraWidthp())+"%"));
mini->pageWidth(LyXLength((par->params().pextraWidthp())+"p%"));
}
Paragraph * op = mini->firstParagraph();
mini->inset.paragraph(par);
@ -1345,9 +1348,19 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
mini->pageWidth(LyXLength(minipar->params().pextraWidth()));
if (!par->params().pextraWidthp().empty()) {
lyxerr << "WP:" << mini->pageWidth().asString() << endl;
mini->pageWidth(LyXLength((par->params().pextraWidthp())+"%"));
mini->pageWidth(LyXLength((par->params().pextraWidthp())+"p%"));
}
Paragraph * op = mini->firstParagraph();
mini->inset.paragraph(minipar);
//
// and free the old ones!
//
while(op) {
Paragraph * pp = op->next();
delete op;
op = pp;
}
// Insert the minipage last in the
// previous paragraph.

View File

@ -1,6 +1,7 @@
2002-03-06 Juergen Vigna <jug@sad.it>
* insettext.C (draw): fixed frame redrawing.
(clear): forgot to set the inset_owner of the paragraph.
* insetert.C (status): pay attention the bv can be 0 here!
(getMaxWidth): add the default leftMargin

View File

@ -227,6 +227,7 @@ void InsetText::clear()
par = tmp;
}
par = new Paragraph;
par->setInsetOwner(this);
par->layout(old_layout);
reinitLyXText();
@ -2137,12 +2138,13 @@ Row * InsetText::crow(BufferView * bv) const
LyXText * InsetText::getLyXText(BufferView const * lbv,
bool const recursive) const
{
if (!recursive && (cached_bview == lbv)) {
if (cached_bview == lbv) {
if (recursive && the_locking_inset)
return the_locking_inset->getLyXText(lbv, true);
LyXText * lt = cached_text.get();
lyx::Assert(lt && lt->firstRow()->par() == par);
return lt;
}
// Super UGLY! (Lgb)
BufferView * bv = const_cast<BufferView *>(lbv);