]> git.lyx.org Git - features.git/commitdiff
Try again to fix Kornel's slowness problem. The previous attempt was
authorRichard Heck <rgheck@lyx.org>
Sat, 9 Mar 2013 17:42:56 +0000 (12:42 -0500)
committerRichard Heck <rgheck@lyx.org>
Sat, 9 Mar 2013 17:42:56 +0000 (12:42 -0500)
worth doing, as we were creating too much output for tooltips anyway.
But we need to ignore BibTeX insets altogether, as the collection of
the references, etc, is too slow.

src/insets/InsetBibtex.cpp
src/insets/InsetExternal.cpp
src/insets/InsetInclude.cpp
src/mathed/InsetFormulaMacro.cpp

index 0392b9d233e9efe3f7a1c3f5705ba68265a958c9..70174730b98842bdbceb84dbf8e0051c7a2eeb99 100644 (file)
@@ -929,16 +929,21 @@ void InsetBibtex::validate(LaTeXFeatures & features) const
 
 
 int InsetBibtex::plaintext(odocstringstream & os,
-       OutputParams const &, size_t max_length) const
+       OutputParams const & op, size_t max_length) const
 {
+       docstring const reflabel = buffer().B_("References");
+
+       if (op.for_tooltip || op.for_toc) {
+               os << reflabel;
+               return reflabel.size();
+       }
+
        BiblioInfo bibinfo = buffer().masterBibInfo();
        bibinfo.makeCitationLabels(buffer());
        vector<docstring> const & cites = bibinfo.citedEntries();
 
        size_t start_size = os.str().size();
        docstring refoutput;
-       docstring const reflabel = buffer().B_("References");
-
        refoutput += reflabel + "\n\n";
 
        // Now we loop over the entries
index e73a6c02f63e5dc25bb97fb388fb35d3caa7a2e3..6c38e1f3a6607af54c0f9b9ae6ee51d47a2202e5 100644 (file)
@@ -694,6 +694,10 @@ void InsetExternal::latex(otexstream & os, OutputParams const & runparams) const
 int InsetExternal::plaintext(odocstringstream & os,
                             OutputParams const & runparams, size_t) const
 {
+       // this is too slow for constant use
+       if (runparams.for_tooltip)
+               return 0;
+
        os << '\n'; // output external material on a new line
        external::writeExternal(params_, "Ascii", buffer(), os,
                                *(runparams.exportdata), false,
index 70050fd5bcfe8968cbf57d7bf7774df419d1224e..c3bd9197ea233b953d1eabfe93d8a947073ec775 100644 (file)
@@ -813,12 +813,18 @@ docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const & rp) const
 int InsetInclude::plaintext(odocstringstream & os,
         OutputParams const & op, size_t) const
 {
-       // don't write the file just because we're making a tooltip or toc entry!!
-       if (op.for_tooltip || op.for_toc || isVerbatim(params()) || isListings(params())) {
-               os << '[' << screenLabel() << '\n';
-               // FIXME: We don't know the encoding of the file, default to UTF-8.
-               os << includedFileName(buffer(), params()).fileContents("UTF-8");
-               os << "\n]";
+       // just write the filename if we're making a tooltip or toc entry
+       if (op.for_tooltip || op.for_toc) {
+               os << '[' << screenLabel() << '\n'
+                  << getParam("filename") << "\n]";
+               return PLAINTEXT_NEWLINE + 1; // one char on a separate line
+       }
+
+       if (isVerbatim(params()) || isListings(params())) {
+               os << '[' << screenLabel() << '\n'
+                  // FIXME: We don't know the encoding of the file, default to UTF-8.
+                  << includedFileName(buffer(), params()).fileContents("UTF-8")
+                  << "\n]";
                return PLAINTEXT_NEWLINE + 1; // one char on a separate line
        }
 
index 88b54c28c5310d84be0783370981b4d9500dd892..88897021fe2bd63fa7fce8e95b8ecbb3d9ce77ee 100644 (file)
@@ -84,7 +84,7 @@ void InsetFormulaMacro::latex(otexstream & os,
 }
 
 
-int InsetFormulaMacro::plaintext(odocstringstream & os, OutputParams const & runparams, int max_length) const
+int InsetFormulaMacro::plaintext(odocstringstream & os, OutputParams const & runparams, size_t) const
 {
        odocstringstream oss;
        WriteStream wi(oss, false, true, WriteStream::wsDefault, runparams.encoding);