]> git.lyx.org Git - lyx.git/blobdiff - src/output_latex.C
remove redundant lyxerr.debugging checks; macro LYXERR already checks whether the...
[lyx.git] / src / output_latex.C
index 58b21f3ea93bde2cd48aeec5bedea10859a89fda..eaa7391449ec3df58210a484aa93266d2be6b49f 100644 (file)
@@ -64,7 +64,7 @@ TeXDeeper(Buffer const & buf,
          odocstream & os, TexRow & texrow,
          OutputParams const & runparams)
 {
-       lyxerr[Debug::LATEX] << "TeXDeeper...     " << &*pit << endl;
+       LYXERR(Debug::LATEX) << "TeXDeeper...     " << &*pit << endl;
        ParagraphList::const_iterator par = pit;
 
        while (par != paragraphs.end() &&
@@ -77,7 +77,7 @@ TeXDeeper(Buffer const & buf,
                                             os, texrow, runparams);
                }
        }
-       lyxerr[Debug::LATEX] << "TeXDeeper...done " << endl;
+       LYXERR(Debug::LATEX) << "TeXDeeper...done " << endl;
 
        return par;
 }
@@ -90,7 +90,7 @@ TeXEnvironment(Buffer const & buf,
               odocstream & os, TexRow & texrow,
               OutputParams const & runparams)
 {
-       lyxerr[Debug::LATEX] << "TeXEnvironment...     " << &*pit << endl;
+       LYXERR(Debug::LATEX) << "TeXEnvironment...     " << &*pit << endl;
 
        BufferParams const & bparams = buf.params();
 
@@ -203,8 +203,8 @@ TeXEnvironment(Buffer const & buf,
                texrow.newline();
        }
 
-       if (par != paragraphs.end() && lyxerr.debugging(Debug::LATEX))
-               lyxerr << "TeXEnvironment...done " << &*par << endl;
+       if (par != paragraphs.end())
+               LYXERR(Debug::LATEX) << "TeXEnvironment...done " << &*par << endl;
        return par;
 }
 
@@ -240,7 +240,7 @@ TeXOnePar(Buffer const & buf,
          OutputParams const & runparams_in,
          string const & everypar)
 {
-       lyxerr[Debug::LATEX] << "TeXOnePar...     " << &*pit << " '"
+       LYXERR(Debug::LATEX) << "TeXOnePar...     " << &*pit << " '"
                << everypar << "'" << endl;
        BufferParams const & bparams = buf.params();
        LyXLayout_ptr style;
@@ -292,24 +292,6 @@ TeXOnePar(Buffer const & buf,
                }
        }
 
-       LyXFont const outerfont =
-               outerFont(std::distance(paragraphs.begin(), pit),
-                         paragraphs);
-       // This must be identical to basefont in Paragraph::simpleTeXOnePar
-       LyXFont basefont = (pit->beginOfBody() > 0) ?
-                       pit->getLabelFont(bparams, outerfont) :
-                       pit->getLayoutFont(bparams, outerfont);
-       Encoding const & outer_encoding(*(outerfont.language()->encoding()));
-       // FIXME we switch from the outer encoding to the encoding of
-       // this paragraph, since I could not figure out the correct
-       // logic to take the encoding of the previous paragraph into
-       // account. This may result in some unneeded encoding changes.
-       if (switchEncoding(os, bparams, outer_encoding,
-                          *(basefont.language()->encoding()))) {
-               os << '\n';
-               texrow.newline();
-       }
-
        // In an inset with unlimited length (all in one row),
        // don't allow any special options in the paragraph
        if (!pit->forceDefaultParagraphs()) {
@@ -360,9 +342,14 @@ TeXOnePar(Buffer const & buf,
                break;
        }
 
+       LyXFont const outerfont =
+               outerFont(std::distance(paragraphs.begin(), pit),
+                         paragraphs);
+
        // FIXME UNICODE
        os << from_utf8(everypar);
        bool need_par = pit->simpleTeXOnePar(buf, bparams, outerfont,
+       //                                     *encoding,
                                             os, texrow, runparams);
 
        // Make sure that \\par is done with the font of the last
@@ -456,17 +443,11 @@ TeXOnePar(Buffer const & buf,
                pending_newline = true;
        }
 
-       // FIXME we switch from the encoding of this paragraph to the
-       // outer encoding, since I could not figure out the correct logic
-       // to take the encoding of the next paragraph into account.
-       // This may result in some unneeded encoding changes.
-       basefont = pit->getLayoutFont(bparams, outerfont);
-       switchEncoding(os, bparams, *(basefont.language()->encoding()),
-                      outer_encoding);
        if (pending_newline) {
                os << '\n';
                texrow.newline();
        }
+       runparams_in.encoding = runparams.encoding;
 
        // we don't need it for the last paragraph!!!
        // Note from JMarc: we will re-add a \n explicitely in
@@ -476,9 +457,8 @@ TeXOnePar(Buffer const & buf,
                texrow.newline();
        }
 
-       if (boost::next(pit) != paragraphs.end() &&
-           lyxerr.debugging(Debug::LATEX))
-               lyxerr << "TeXOnePar...done " << &*boost::next(pit) << endl;
+       if (boost::next(pit) != paragraphs.end())
+               LYXERR(Debug::LATEX) << "TeXOnePar...done " << &*boost::next(pit) << endl;
 
        return ++pit;
 }
@@ -594,7 +574,7 @@ int switchEncoding(odocstream & os, BufferParams const & bparams,
            oldEnc.name() != newEnc.name() &&
            oldEnc.name() != "ascii" && newEnc.name() != "ascii" &&
            oldEnc.name() != "tis620-0" && newEnc.name() != "tis620-0") {
-               lyxerr[Debug::LATEX] << "Changing LaTeX encoding from "
+               LYXERR(Debug::LATEX) << "Changing LaTeX encoding from "
                                     << oldEnc.name() << " to "
                                     << newEnc.name() << endl;
                os << setEncoding(newEnc.iconvName());