]> git.lyx.org Git - features.git/commitdiff
InsetERT write/read fixes.
authorJürgen Vigna <jug@sad.it>
Tue, 7 Aug 2001 08:05:31 +0000 (08:05 +0000)
committerJürgen Vigna <jug@sad.it>
Tue, 7 Aug 2001 08:05:31 +0000 (08:05 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2436 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetert.C

index caf55612467eaf5207541f95b6f5b82a9e04959a..994d2f9784ad612afe8abb649dd6284bb19f9f07 100644 (file)
@@ -1,3 +1,9 @@
+2001-08-07  Juergen Vigna  <jug@sad.it>
+
+       * 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  <jug@sad.it>
 
        * insetert.C (set_latex_font): use LyXText's setFont directly.
index cc1ea5ba3ced5ca192dded39962137738a777e60..550ecaa3517eeb057e1879353340af8edb9d1937 100644 (file)
@@ -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);
        }
 }