X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FConverter.cpp;h=6acd05a22b1b8c902138575bb9d1af700c2db187;hb=d1dddde6d800834eb6b8c7626da4d251e7c74f08;hp=0f97b7396ee9b37e3351d3da503303fa7a4f7450;hpb=88c274eee745433ba14c571f29834b68b8627a91;p=lyx.git diff --git a/src/Converter.cpp b/src/Converter.cpp index 0f97b7396e..6acd05a22b 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -29,6 +29,7 @@ #include "support/FileNameList.h" #include "support/filetools.h" #include "support/gettext.h" +#include "support/lassert.h" #include "support/lstrings.h" #include "support/os.h" #include "support/Package.h" @@ -306,8 +307,9 @@ bool Converters::convert(Buffer const * buffer, LYXERR(Debug::FILES, "No converter defined! " "I use convertDefault.py:\n\t" << command); Systemcall one; - one.startscript(Systemcall::Wait, command, buffer ? - buffer->filePath() : string()); + one.startscript(Systemcall::Wait, command, + buffer ? buffer->filePath() : string(), + buffer ? buffer->layoutPos() : string()); if (to_file.isReadableFile()) { if (conversionflags & try_cache) ConverterCache::get().add(orig_from, @@ -474,13 +476,16 @@ bool Converters::convert(Buffer const * buffer, if (dummy) { res = one.startscript(Systemcall::DontWait, to_filesystem8bit(from_utf8(command)), - buffer ? buffer->filePath() : string()); + buffer ? buffer->filePath() : string(), + buffer ? buffer->layoutPos() : string()); // We're not waiting for the result, so we can't do anything // else here. } else { res = one.startscript(Systemcall::Wait, to_filesystem8bit(from_utf8(command)), buffer ? buffer->filePath() + : string(), + buffer ? buffer->layoutPos() : string()); if (!real_outfile.empty()) { Mover const & mover = getMover(conv.to()); @@ -501,7 +506,8 @@ bool Converters::convert(Buffer const * buffer, " > " + quoteName(logfile); one.startscript(Systemcall::Wait, to_filesystem8bit(from_utf8(command2)), - buffer->filePath()); + buffer->filePath(), + buffer->layoutPos()); if (!scanLog(*buffer, command, makeAbsPath(logfile, path), errorList)) return false; } @@ -624,7 +630,7 @@ bool Converters::scanLog(Buffer const & buffer, string const & /*command*/, namespace { class ShowMessage - : public boost::signals::trackable { + : public boost::signals2::trackable { public: ShowMessage(Buffer const & b) : buffer_(b) {} void operator()(docstring const & msg) const { buffer_.message(msg); } @@ -644,7 +650,8 @@ bool Converters::runLaTeX(Buffer const & buffer, string const & command, // do the LaTeX run(s) string const name = buffer.latexName(); LaTeX latex(command, runparams, FileName(makeAbsPath(name)), - buffer.filePath()); + buffer.filePath(), buffer.layoutPos(), + buffer.lastPreviewError()); TeXErrors terr; ShowMessage show(buffer); latex.message.connect(show); @@ -653,8 +660,12 @@ bool Converters::runLaTeX(Buffer const & buffer, string const & command, if (result & LaTeX::ERRORS) buffer.bufferErrors(terr, errorList); - // check return value from latex.run(). - if (result & LaTeX::NO_LOGFILE) { + if (!errorList.empty()) { + // We will show the LaTeX Errors GUI later which contains + // specific error messages so it would be repetitive to give + // e.g. the "finished with an error" dialog in addition. + } + else if (result & LaTeX::NO_LOGFILE) { docstring const str = bformat(_("LaTeX did not run successfully. " "Additionally, LyX could not locate " @@ -666,7 +677,6 @@ bool Converters::runLaTeX(Buffer const & buffer, string const & command, "finished with an error. " "It is recommended you fix the cause of the external " "program's error (check the logs). "), from_utf8(command)); - // FIXME: In LyX 2.3.0 the warning will be converted to an error. Alert::error(_("LaTeX failed"), str); } else if (result & LaTeX::NO_OUTPUT) { Alert::warning(_("Output is empty"), @@ -698,6 +708,8 @@ void Converters::buildGraph() for (; it != end ; ++it) { int const from = formats.getNumber(it->from()); int const to = formats.getNumber(it->to()); + LASSERT(from >= 0, continue); + LASSERT(to >= 0, continue); G_.addEdge(from, to); } }