]> git.lyx.org Git - lyx.git/commitdiff
speedup latex export a lot
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 5 Aug 2004 09:18:54 +0000 (09:18 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 5 Aug 2004 09:18:54 +0000 (09:18 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8869 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/insets/ChangeLog
src/insets/insetfoot.C
src/insets/insetquotes.C
src/outputparams.h
src/paragraph.C

index 43707d3d834f56cf151f7110738dd3e6c787f935..898931c72be171b154757a0d789a646391534f0c 100644 (file)
@@ -1,3 +1,10 @@
+2004-08-04  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * outputparams.h: add new members intitle and lang.
+
+       * paragraph.C (simpleTeXOnePar): initialize rp.lang and
+       rp.intitle. Actually use rp in call to simpleTeXSpecialChars
+
 2004-08-01  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
        * text3.C (dispatch): remove special handling of button 4 and 5,
index f22182495d979c035e83628e45e890994078301c..dc0334bfdc363fe624907c8855ac60e44f08671b 100644 (file)
@@ -1,3 +1,11 @@
+2004-08-04  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * insetfoot.C (latex): use OutputParams::intitle instead of
+       parOwner() (avoids time consuming lookup)
+
+       * insetquotes.C (latex): same as above with OutputParams::lang.
+       Moreover the code actually works now.
+
 2004-07-24  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
        * insetwrap.C, insetvspace.C, insettabular.C, insetnote.C:
index cc844c8c622002277739f458c877972f404f5e3d..2d3b0c6f5cc03c34a01d5dbe57f9ca2519b18ce4 100644 (file)
@@ -61,7 +61,8 @@ int InsetFoot::latex(Buffer const & buf, ostream & os,
                     OutputParams const & runparams_in) const
 {
        OutputParams runparams = runparams_in;
-       runparams.moving_arg |= ownerPar(buf, this).layout()->intitle;
+       // footnotes in titling commands like \title have moving arguments
+       runparams.moving_arg |= runparams_in.intitle;
 
        os << "%\n\\footnote{";
 
index 1cf4d5bb8a6125bb35df9531992f408dabfa9c1e..78424adc990e1328bc87621544afc9865a126f28 100644 (file)
@@ -263,35 +263,20 @@ void InsetQuotes::read(Buffer const &, LyXLex & lex)
 }
 
 
-int InsetQuotes::latex(Buffer const & buf, ostream & os,
+int InsetQuotes::latex(Buffer const &, ostream & os,
                       OutputParams const & runparams) const
 {
-       // How do we get the local language here??
-       lyx::pos_type curr_pos = ownerPar(buf, this).getPositionOfInset(this);
-       BOOST_ASSERT(curr_pos != -1);
-
-#ifdef WITH_WARNINGS
-#warning FIXME. We _must_ find another way to get the language. (Lgb)
-#endif
-#if 0
-       // This cannot be used. (Lgb)
-       string const curr_lang =
-               parOwner()->getFont(buf->params, curr_pos).language()->babel();
-#else
-       // And this is not the way... (Lgb)
-       string const curr_lang = buf.params().language->lang();
-#endif
        const int quoteind = quote_index[side_][language_];
        string qstr;
 
        if (language_ == FrenchQ && times_ == DoubleQ
-           && curr_lang == "frenchb") {
+           && runparams.lang == "frenchb") {
                if (side_ == LeftQ)
                        qstr = "\\og "; //the spaces are important here
                else
                        qstr = " \\fg{}"; //and here
        } else if (language_ == FrenchQ && times_ == DoubleQ
-                  && curr_lang == "french") {
+                  && runparams.lang == "french") {
                if (side_ == LeftQ)
                        qstr = "<< "; //the spaces are important here
                else
index 7c1bc1d6fbc587de2f2bfb12e874e88b20d1f1d1..54029f58d94f8e0546ac6ccc53cb1bc738b7a176 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef OUTPUTPARAMS_H
 #define OUTPUTPARAMS_H
 
+#include <string>
+
 #include "support/types.h"
 #include <boost/shared_ptr.hpp>
 
@@ -48,6 +50,16 @@ struct OutputParams {
        */
        bool moving_arg;
 
+       /** intitle == true means that the environment in which the
+           inset is typeset is part of a title (before a \maketitle).
+           Footnotes in such environments have moving arguments.
+       */
+       bool intitle;
+
+       /** the babel name of the language at the point where the inset is
+        */
+       std::string lang;
+
        /** free_spacing == true means that the inset is in a free-spacing
            paragraph.
        */
index 66eebe04eb15c016a0d0e44005351b670c90175b..1a6cdfc35a5a61713500709dde8b7fd92b9414e3 100644 (file)
@@ -924,8 +924,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
                basefont = getLayoutFont(bparams, outerfont);
        }
 
-       bool moving_arg = runparams.moving_arg;
-       moving_arg |= style->needprotect;
+       bool const moving_arg = runparams.moving_arg | style->needprotect;
 
        // Which font is currently active?
        LyXFont running_font(basefont);
@@ -1027,8 +1026,10 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
                OutputParams rp = runparams;
                rp.moving_arg = moving_arg;
                rp.free_spacing = style->free_spacing;
+               rp.lang = font.language()->babel();
+               rp.intitle = style->intitle;
                pimpl_->simpleTeXSpecialChars(buf, bparams,
-                                             os, texrow, runparams,
+                                             os, texrow, rp,
                                              font, running_font,
                                              basefont, outerfont, open_font,
                                              running_change,