]> git.lyx.org Git - features.git/commitdiff
The 'nice' changes.
authorAngus Leeming <leeming@lyx.org>
Thu, 22 May 2003 21:10:22 +0000 (21:10 +0000)
committerAngus Leeming <leeming@lyx.org>
Thu, 22 May 2003 21:10:22 +0000 (21:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7013 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/ChangeLog
src/buffer.C
src/buffer.h
src/bufferlist.C
src/exporter.C
src/graphics/ChangeLog
src/graphics/PreviewLoader.C
src/insets/ChangeLog
src/insets/insetbibtex.C
src/insets/insetgraphics.C
src/insets/insetinclude.C
src/latexrunparams.h

index 03adbb5a699eae86ef748b9dbb80a9a30f5cbfdd..1af9be28677820c94bfc1e5b47fe2f2496ff426c 100644 (file)
@@ -2,6 +2,16 @@
 
        * paragraph.C (Paragraph): initialize next_par_ and prev_par_
 
+2003-05-22  Angus Leeming  <leeming@lyx.org>
+
+       * latexrunparams.h: add a 'bool nice' which defaults to false.
+
+       * buffer.[Ch] (makeLaTeXFile): remove the nice parameter as it is
+       now encapsulated within runparams.
+
+       * bufferlist.C (updateIncludedTeXfiles):
+       * exporter.C (Export): ensuing change to the calls to makeLaTeXFile.
+
 2003-05-22  Angus Leeming  <leeming@lyx.org>
 
        * latexrunparams.h: new file containing struct LatexRunParams.
index 2e915abc33c2c44b86aa9d24414eb01518b040ff..00ec0e569b7524ea73a346aee574d564297fd29f 100644 (file)
@@ -952,7 +952,7 @@ void Buffer::writeFileAscii(ostream & os, int linelen)
 void Buffer::makeLaTeXFile(string const & fname,
                           string const & original_path,
                           LatexRunParams const & runparams,
-                          bool nice, bool only_body, bool only_preamble)
+                          bool only_body, bool only_preamble)
 {
        lyxerr[Debug::LATEX] << "makeLaTeXFile..." << endl;
 
@@ -966,7 +966,7 @@ void Buffer::makeLaTeXFile(string const & fname,
        }
 
        makeLaTeXFile(ofs, original_path,
-                     runparams, nice, only_body, only_preamble);
+                     runparams, only_body, only_preamble);
 
        ofs.close();
        if (ofs.fail()) {
@@ -977,10 +977,11 @@ void Buffer::makeLaTeXFile(string const & fname,
 
 void Buffer::makeLaTeXFile(ostream & os,
                           string const & original_path,
-                          LatexRunParams const & runparams,
-                          bool nice, bool only_body, bool only_preamble)
+                          LatexRunParams const & runparams_in,
+                          bool only_body, bool only_preamble)
 {
-       niceFile = nice; // this will be used by Insetincludes.
+       LatexRunParams runparams = runparams_in;
+       niceFile = runparams.nice; // this will be used by Insetincludes.
 
        // validate the buffer.
        lyxerr[Debug::LATEX] << "  Validating buffer..." << endl;
@@ -993,7 +994,7 @@ void Buffer::makeLaTeXFile(ostream & os,
        // first paragraph of the document. (Asger)
        texrow.start(paragraphs.begin()->id(), 0);
 
-       if (!only_body && nice) {
+       if (!only_body && runparams.nice) {
                os << "%% " << lyx_docversion << " created this file.  "
                        "For more info, see http://www.lyx.org/.\n"
                        "%% Do not edit unless you really know what "
@@ -1010,7 +1011,7 @@ void Buffer::makeLaTeXFile(ostream & os,
        // original_path is set. This is done for usual tex-file, but not
        // for nice-latex-file. (Matthias 250696)
        if (!only_body) {
-               if (!nice) {
+               if (!runparams.nice) {
                        // code for usual, NOT nice-latex-file
                        os << "\\batchmode\n"; // changed
                        // from \nonstopmode
@@ -1963,7 +1964,8 @@ int Buffer::runChktex()
        // Generate the LaTeX file if neccessary
        LatexRunParams runparams;
        runparams.flavor = LatexRunParams::LATEX;
-       makeLaTeXFile(name, org_path, runparams, false);
+       runparams.nice = false;
+       makeLaTeXFile(name, org_path, runparams);
 
        TeXErrors terr;
        Chktex chktex(lyxrc.chktex_command, name, filePath());
index d90526879789da9f2335f31d87ad9df769ffb694..468178b0f8281fa2e39a374f32b9c4221e5fb384 100644 (file)
@@ -148,14 +148,12 @@ public:
        void makeLaTeXFile(string const & filename,
                           string const & original_path,
                           LatexRunParams const &,
-                          bool nice,
                           bool only_body = false,
                           bool only_preamble = false);
        ///
        void makeLaTeXFile(std::ostream & os,
                           string const & original_path,
                           LatexRunParams const &,
-                          bool nice,
                           bool only_body = false,
                           bool only_preamble = false);
        ///
index a32bafd2a4386f7dd0ce34e257f8b5a4e4b4c65e..cc2dcdcb0468647f3138613daa1cc4edffd391e5 100644 (file)
@@ -235,7 +235,7 @@ void BufferList::updateIncludedTeXfiles(string const & mastertmpdir,
                        writefile += '/';
                        writefile += (*it)->getLatexName();
                        (*it)->makeLaTeXFile(writefile, mastertmpdir,
-                                            runparams, false, true);
+                                            runparams, true);
                        (*it)->markDepClean(mastertmpdir);
                }
        }
index 2a1d8850e23956d5915e5414beb8761938130720..e32a451926d200590674b73bb9412ef06f2a72ea 100644 (file)
@@ -83,15 +83,17 @@ bool Exporter::Export(Buffer * buffer, string const & format,
        else if (buffer->isDocBook())
                buffer->makeDocBookFile(filename, !put_in_tempdir);
        // LaTeX backend
-       else if (backend_format == format)
-               buffer->makeLaTeXFile(filename, string(), runparams, true);
-       else if (contains(buffer->filePath(), ' ')) {
+       else if (backend_format == format) {
+               runparams.nice = true;
+               buffer->makeLaTeXFile(filename, string(), runparams);
+       } else if (contains(buffer->filePath(), ' ')) {
                Alert::error(_("File name error"),
                           _("The directory path to the document cannot contain spaces."));
                return false;
-       } else
-               buffer->makeLaTeXFile(filename, buffer->filePath(),
-                                     runparams, false);
+       } else {
+               runparams.nice = false;
+               buffer->makeLaTeXFile(filename, buffer->filePath(), runparams);
+       }
 
        string outfile_base = (put_in_tempdir)
                ? filename : buffer->getLatexName(false);
index 391de0e768f19c1d935c9052dd927585ba678f95..85b4c670adf7ad99272fdff943f73ef8d3b65f8f 100644 (file)
@@ -1,3 +1,8 @@
+2003-05-22  Angus Leeming  <leeming@lyx.org>
+
+       * PreviewLoader.C (dumpPreamble): the 'nice' param passed to
+       makeLaTeXFile is now encapsulated within runparams.
+
 2003-05-22  Angus Leeming  <leeming@lyx.org>
 
        * PreviewLoader.C (dumpPreamble):
index 6a92629ae1a8da10385d2f2e00c635de629f97b9..9b90e0aff774dfdd6b62169926efb9232da4bf77 100644 (file)
@@ -566,7 +566,8 @@ void PreviewLoader::Impl::dumpPreamble(ostream & os) const
        // Dump the preamble only.
        LatexRunParams runparams;
        runparams.flavor = LatexRunParams::LATEX;
-       tmp.makeLaTeXFile(os, buffer_.filePath(), runparams, true, false, true);
+       runparams.nice = true;
+       tmp.makeLaTeXFile(os, buffer_.filePath(), runparams, false, true);
 
        // FIXME! This is a HACK! The proper fix is to control the 'true'
        // passed to WriteStream below:
index 9cc1b43f5354a87d35d79faacb23a0e50077ca45..162b2f64f946ee5a0282bb3f4cdc2c02cd2dfb61 100644 (file)
@@ -2,6 +2,13 @@
 
        * insetspecialchar.C (dimension): use a string.
 
+2003-05-22  Angus Leeming  <leeming@lyx.org>
+
+       * insetbibtex.C (latex):
+       * insetgraphics.C (latex):
+       * insetinclude.C (latex): extract the buffer's 'nice'ness from
+       runparams rather than from the buffer itself.
+
 2003-05-22  Angus Leeming  <leeming@lyx.org>
 
        * inset*.[Ch] (latex):
index 9c8b162904e2ef4e320510fe7955d7491564ecbf..3d2531f3452791a7cdb347ed3efd5502a27e9daa 100644 (file)
@@ -16,6 +16,7 @@
 #include "debug.h"
 #include "funcrequest.h"
 #include "gettext.h"
+#include "latexrunparams.h"
 
 #include "support/filetools.h"
 #include "support/path.h"
@@ -82,7 +83,8 @@ string const InsetBibtex::getScreenLabel(Buffer const *) const
 }
 
 
-int InsetBibtex::latex(Buffer const * buffer, ostream & os, LatexRunParams const &,
+int InsetBibtex::latex(Buffer const * buffer, ostream & os,
+                      LatexRunParams const & runparams,
                       bool /*fragile*/, bool/*fs*/) const
 {
        // changing the sequence of the commands
@@ -103,7 +105,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os, LatexRunParams const
                }
        }
 
-       if (!buffer->niceFile
+       if (!runparams.nice
            && IsFileReadable(MakeAbsPath(style, buffer->filePath()) + ".bst")) {
                style = MakeAbsPath(style, buffer->filePath());
        }
@@ -143,7 +145,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os, LatexRunParams const
        // have a comma-separated list of bibliographies
        string db_out;
        while (!adb.empty()) {
-               if (!buffer->niceFile &&
+               if (!runparams.nice &&
                    IsFileReadable(MakeAbsPath(adb, buffer->filePath())+".bib"))
                         adb = os::external_path(MakeAbsPath(adb, buffer->filePath()));
                db_out += adb;
index 61e55499e87f70d21a730ba4f28c72ebfc675e69..cda1d8d3ead3a2e7ece063d5418c99ccd8c2024e 100644 (file)
@@ -672,7 +672,8 @@ string const InsetGraphics::prepareFile(Buffer const * buf,
 }
 
 
-int InsetGraphics::latex(Buffer const * buf, ostream & os, LatexRunParams const & runparams,
+int InsetGraphics::latex(Buffer const * buf, ostream & os,
+                        LatexRunParams const & runparams,
                         bool /*fragile*/, bool/*fs*/) const
 {
        // If there is no file specified or not existing,
@@ -726,7 +727,7 @@ int InsetGraphics::latex(Buffer const * buf, ostream & os, LatexRunParams const
 
        // "nice" means that the buffer is exported to LaTeX format but not
        //        run through the LaTeX compiler.
-       if (buf->niceFile) {
+       if (runparams.nice) {
                os << before <<'{' << params().filename << '}' << after;
                return 1;
        }
index fa8bd85bf81c4e90b16f9c0f7a9d0a9fd96d710e..d334c7307c799405809b304a5cae09b35d0697cf 100644 (file)
@@ -313,8 +313,7 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os,
                // write it to a file (so far the complete file)
                string writefile = ChangeExtension(getFileName(), ".tex");
 
-               if (!buffer->tmppath.empty()
-                   && !buffer->niceFile) {
+               if (!buffer->tmppath.empty() && !runparams.nice) {
                        incfile = subst(incfile, '/','@');
 #ifdef __EMX__
                        incfile = subst(incfile, ':', '$');
@@ -328,10 +327,8 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os,
 
                tmp->markDepClean(buffer->tmppath);
 
-               tmp->makeLaTeXFile(writefile,
-                                  OnlyPath(getMasterFilename()),
-                                  runparams,
-                                  buffer->niceFile, true);
+               tmp->makeLaTeXFile(writefile, OnlyPath(getMasterFilename()),
+                                  runparams, true);
        }
 
        if (isVerbatim()) {
index baf5f2e997e0315a4c357ea2e02f2e9ec8845ffc..77d8140f7151956199cbd39a42b829ba74b92467 100644 (file)
 #ifndef LatexRunParams_H
 #define LatexRunParams_H
 
-/** The latex that we export depends occasionally on what is to
-    compile the file.
-*/
 struct LatexRunParams {
         enum FLAVOR {
                 LATEX,
                 PDFLATEX
         };
 
-        LatexRunParams() : flavor(LATEX) {}
-       //, nice(false), fragile(false) {}
+        LatexRunParams() : flavor(LATEX), nice(false) {}
 
+       /** The latex that we export depends occasionally on what is to
+           compile the file.
+       */
         FLAVOR flavor;
-//         bool nice;
-//         bool fragile;
+       /** Are we to write a 'nice' LaTeX file or not.
+           This esentially seems to mean whether InsetInclude, InsetGraphics
+           and InsetExternal should add the absolute path to any external
+           files or not.
+       */
+       bool nice;
 };
 
-// enum LatexFlavor {
-//     LATEX_FLAVOR,
-//     PDFLATEX_FLAVOR
-// };
-
 #endif // LatexRunParams_H