From a8cd821af102185d0888ef94ed81a78a74f42cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Vigna?= Date: Tue, 7 Aug 2001 08:05:31 +0000 Subject: [PATCH] InsetERT write/read fixes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2436 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/ChangeLog | 6 ++++++ src/insets/insetert.C | 34 +++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index caf5561246..994d2f9784 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2001-08-07 Juergen Vigna + + * insetert.C (read): don't use InsetCollapsable::read as we don't + write the collapsed status anymore only the status. + (write): ditto. + 2001-08-06 Juergen Vigna * insetert.C (set_latex_font): use LyXText's setFont directly. diff --git a/src/insets/insetert.C b/src/insets/insetert.C index cc1ea5ba3c..550ecaa351 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -99,12 +99,12 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex) string const tmp_token = lex.getString(); if (tmp_token == "Inlined") { - status_ = Inlined; + status(0, Inlined); } else if (tmp_token == "Collapsed") { - status_ = Collapsed; + status(0, Collapsed); } else { // leave this as default! - status_ = Open; + status(0, Open); } token_found = true; @@ -115,12 +115,25 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex) lex.pushToken(token); } } - InsetCollapsable::read(buf, lex); +#warning this should be really short lived only for compatibility to +#warning files written 07/08/2001 so this has to go before 1.2.0! (Jug) + if (lex.isOK()) { + lex.next(); + string const token = lex.getString(); + if (token == "collapsed") { + lex.next(); + collapsed_ = lex.getBool(); + } else { + // Take countermeasures + lex.pushToken(token); + } + } + inset.read(buf, lex); if (!token_found) { if (collapsed_) { - status_ = Collapsed; + status(0, Collapsed); } else { - status_ = Open; + status(0, Open); } } setButtonLabel(); @@ -145,7 +158,8 @@ void InsetERT::write(Buffer const * buf, ostream & os) const os << getInsetName() << "\n" << "status "<< st << "\n"; - InsetCollapsable::write(buf, os); + + inset.writeParagraphData(buf, os); } @@ -454,10 +468,12 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) collapsed_ = true; need_update = FULL; setButtonLabel(); - bv->unlockInset(this); + if (bv) + bv->unlockInset(this); break; } - bv->updateInset(this, true); + if (bv) + bv->updateInset(this, true); } }