* 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.
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;
}
makeLaTeXFile(ofs, original_path,
- runparams, nice, only_body, only_preamble);
+ runparams, only_body, only_preamble);
ofs.close();
if (ofs.fail()) {
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;
// 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 "
// 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
// 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());
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);
///
writefile += '/';
writefile += (*it)->getLatexName();
(*it)->makeLaTeXFile(writefile, mastertmpdir,
- runparams, false, true);
+ runparams, true);
(*it)->markDepClean(mastertmpdir);
}
}
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);
+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):
// 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:
* 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):
#include "debug.h"
#include "funcrequest.h"
#include "gettext.h"
+#include "latexrunparams.h"
#include "support/filetools.h"
#include "support/path.h"
}
-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
}
}
- if (!buffer->niceFile
+ if (!runparams.nice
&& IsFileReadable(MakeAbsPath(style, buffer->filePath()) + ".bst")) {
style = MakeAbsPath(style, buffer->filePath());
}
// 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;
}
-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,
// "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;
}
// 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, ':', '$');
tmp->markDepClean(buffer->tmppath);
- tmp->makeLaTeXFile(writefile,
- OnlyPath(getMasterFilename()),
- runparams,
- buffer->niceFile, true);
+ tmp->makeLaTeXFile(writefile, OnlyPath(getMasterFilename()),
+ runparams, true);
}
if (isVerbatim()) {
#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