]> git.lyx.org Git - features.git/commitdiff
Fix (partially) font bug in compatability code.
authorDekel Tsur <dekelts@tau.ac.il>
Sat, 12 Jan 2002 18:40:05 +0000 (18:40 +0000)
committerDekel Tsur <dekelts@tau.ac.il>
Sat, 12 Jan 2002 18:40:05 +0000 (18:40 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3345 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/buffer.C
src/buffer.h
src/insets/insettext.C
src/tabular.C

index 64d60bb3ef186ee3d91fdf6d8616168e1cbb0cde..731201d5387210f8104fbaeab25d427de9c3cff8 100644 (file)
@@ -1,3 +1,7 @@
+2002-01-12  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * buffer.C (insertErtContents): Fix (partially) the font bug.
+
 2002-01-11  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * BufferView2.C (ChangeRefsIfUnique): use the HP version of std::count
index 2c3fd7f1afe9b66eda8846b39f6c0452e91a2dc8..873d135c900642536a6e699f190ab2c129fbb490 100644 (file)
@@ -287,6 +287,7 @@ struct ErtComp
        string contents;
        bool active;
        bool in_tabular;
+       LyXFont font;
 };
 
 std::stack<ErtComp> ert_stack;
@@ -395,16 +396,13 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
 
 
 #ifndef NO_COMPABILITY
-void Buffer::insertErtContents(Paragraph * par, int & pos,
-                       LyXFont const & f, bool set_inactive) 
+void Buffer::insertErtContents(Paragraph * par, int & pos, bool set_inactive) 
 {
        if (!ert_comp.contents.empty()) {
                lyxerr[Debug::INSETS] << "ERT contents:\n'"
                                      << ert_comp.contents << "'" << endl;
                Inset * inset = new InsetERT(ert_comp.contents, true);
-               LyXFont font;
-               font.setLanguage(f.language());
-               par->insertInset(pos++, inset, font);
+               par->insertInset(pos++, inset, ert_comp.font);
                ert_comp.contents.erase();
        }
        if (set_inactive) {
@@ -457,7 +455,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
 #ifndef NO_COMPABILITY
                ert_comp.in_tabular = false;
                // Do the insetert.
-               insertErtContents(par, pos, font);
+               insertErtContents(par, pos);
 #endif
                lex.eatLine();
                string const layoutname = lex.getString();
@@ -472,6 +470,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
 #ifndef NO_COMPABILITY
                if (compare_no_case(layoutname, "latex") == 0) {
                        ert_comp.active = true;
+                       ert_comp.font = font;
                }
 #endif
 #ifdef USE_CAPTION
@@ -575,8 +574,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
 
 #ifndef NO_COMPABILITY
        } else if (token == "\\begin_float") {
-               insertErtContents(par, pos, font);
-               //insertErtContents(par, pos, font, false);
+               insertErtContents(par, pos);
+               //insertErtContents(par, pos, false);
                //ert_stack.push(ert_comp);
                //ert_comp = ErtComp();
                
@@ -666,7 +665,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                inset->read(this, nylex);
                par->insertInset(pos, inset, font);
                ++pos;
-               insertErtContents(par, pos, font);
+               insertErtContents(par, pos);
 #endif
        } else if (token == "\\begin_deeper") {
                ++depth;
@@ -977,12 +976,13 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                string const tok = lex.getString();
                if (tok == "no_latex") {
                        // Do the insetert.
-                       insertErtContents(par, pos, font);
+                       insertErtContents(par, pos);
                } else if (tok == "latex") {
                        ert_comp.active = true;
+                       ert_comp.font = font;
                } else if (tok == "default") {
                        // Do the insetert.
-                       insertErtContents(par, pos, font);
+                       insertErtContents(par, pos);
                } else {
                        lex.printError("Unknown LaTeX font flag "
                                       "`$$Token'");
@@ -1073,7 +1073,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                // the inset isn't it? Lgb.
        } else if (token == "\\begin_inset") {
 #ifndef NO_COMPABILITY
-               insertErtContents(par, pos, font, false);
+               insertErtContents(par, pos, false);
                ert_stack.push(ert_comp);
                ert_comp = ErtComp();
 #endif
@@ -1081,7 +1081,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
 #ifndef NO_COMPABILITY
                ert_comp = ert_stack.top();
                ert_stack.pop();
-               insertErtContents(par, pos, font);
+               insertErtContents(par, pos);
 #endif
        } else if (token == "\\SpecialChar") {
                LyXLayout const & layout =
@@ -1119,7 +1119,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                        // Since we cannot know it this is only a regular
                        // newline or a tabular cell delimter we have to
                        // handle the ERT here.
-                       insertErtContents(par, pos, font, false);
+                       insertErtContents(par, pos, false);
 
                        par->insertChar(pos, Paragraph::META_NEWLINE, font);
                        ++pos;
@@ -1175,7 +1175,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
 #ifndef NO_COMPABILITY
                // If we still have some ert active here we have to insert
                // it so we don't loose it. (Lgb)
-               insertErtContents(par, pos, font);
+               insertErtContents(par, pos);
 #endif
                the_end_read = true;
 #ifndef NO_COMPABILITY
index 4110e4e768a5809ae7c38942a77afb59b5851582..a85e04a4c151de18df0c2002f39a60320e7f53d6 100644 (file)
@@ -128,7 +128,6 @@ public:
 #ifndef NO_COMPABILITY
        ///
        void insertErtContents(Paragraph * par, int & pos,
-                              LyXFont const & font,
                               bool set_inactive = true);
 #endif
        ///
index ea1c025a34968487bfd56917547c5df4eaa4b82a..2b44ae2cc506968b95443b5655f4aa94fc96e66d 100644 (file)
@@ -262,7 +262,7 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
                        continue;
                if (token == "\\end_inset") {
 #ifndef NO_COMPABILITY
-                       const_cast<Buffer*>(buf)->insertErtContents(par, pos, font, false);
+                       const_cast<Buffer*>(buf)->insertErtContents(par, pos, false);
 #endif
                        break;
                }
index 85adc025e617e93bc7f6985cf102bb1bb1c64838..d8623ee958b40acb5018c68e64e2df6cd81d88d2 100644 (file)
@@ -1440,7 +1440,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
 #ifndef NO_COMPABILITY
                        // Here we need to insert the inset_ert_contents into the last
                        // cell of the tabular.
-                       owner_->bufferOwner()->insertErtContents(par, pos, font);
+                       owner_->bufferOwner()->insertErtContents(par, pos);
 #endif
                        break;
                }