From b1be8f3cb0486b659ff7e35601d2ed74d3ce29e0 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 5 Aug 2004 09:18:54 +0000 Subject: [PATCH] speedup latex export a lot git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8869 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 7 +++++++ src/insets/ChangeLog | 8 ++++++++ src/insets/insetfoot.C | 3 ++- src/insets/insetquotes.C | 21 +++------------------ src/outputparams.h | 12 ++++++++++++ src/paragraph.C | 7 ++++--- 6 files changed, 36 insertions(+), 22 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 43707d3d83..898931c72b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2004-08-04 Jean-Marc Lasgouttes + + * 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 * text3.C (dispatch): remove special handling of button 4 and 5, diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index f22182495d..dc0334bfdc 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,11 @@ +2004-08-04 Jean-Marc Lasgouttes + + * 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 * insetwrap.C, insetvspace.C, insettabular.C, insetnote.C: diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index cc844c8c62..2d3b0c6f5c 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -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{"; diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 1cf4d5bb8a..78424adc99 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -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 diff --git a/src/outputparams.h b/src/outputparams.h index 7c1bc1d6fb..54029f58d9 100644 --- a/src/outputparams.h +++ b/src/outputparams.h @@ -12,6 +12,8 @@ #ifndef OUTPUTPARAMS_H #define OUTPUTPARAMS_H +#include + #include "support/types.h" #include @@ -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. */ diff --git a/src/paragraph.C b/src/paragraph.C index 66eebe04eb..1a6cdfc35a 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -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, -- 2.39.2