mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
The 'nice' changes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7013 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
36027c932b
commit
e9d6c8c04c
@ -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.
|
||||
|
18
src/buffer.C
18
src/buffer.C
@ -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());
|
||||
|
@ -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);
|
||||
///
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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):
|
||||
|
@ -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:
|
||||
|
@ -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):
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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()) {
|
||||
|
@ -12,26 +12,24 @@
|
||||
#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
|
||||
|
Loading…
Reference in New Issue
Block a user