#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include "converter.h"
#include "lyxrc.h"
#include "buffer.h"
}
+// FIXME: horrednously mis-named, especially given the other ::add
+// function
void Formats::add(string const & name, string const & extension,
string const & prettyname, string const & shortcut)
{
if (format_name == "dvi" &&
!lyxrc.view_dvi_paper_option.empty()) {
- command += " " + lyxrc.view_dvi_paper_option;
+ command += ' ' + lyxrc.view_dvi_paper_option;
string paper_size = converters.papersize(buffer);
if (paper_size == "letter")
paper_size = "us";
- command += " " + paper_size;
+ command += ' ' + paper_size;
if (buffer->params.orientation
== BufferParams::ORIENTATION_LANDSCAPE)
command += 'r';
}
if (!contains(command, token_from))
- command += " " + token_from;
+ command += ' ' + token_from;
command = subst(command, token_from,
QuoteName(OnlyFilename(filename)));
subst(conv.result_file,
token_base, OnlyFilename(from_base)));
+ // if input and output files are equal, we use a
+ // temporary file as intermediary (JMarc)
+ string real_outfile;
+ if (outfile == infile) {
+ real_outfile = infile;
+ outfile = AddName(buffer->tmppath, "tmpfile.out");
+ }
+
if (conv.latex) {
run_latex = true;
string command = subst(conv.command, token_from, "");
} else
res = one.startscript(type, command);
+ if (!real_outfile.empty()) {
+ if (!lyx::rename(outfile, real_outfile))
+ res = -1;
+ else
+ lyxerr[Debug::FILES]
+ << "renaming file " << outfile
+ << " to " << real_outfile
+ << endl;
+ }
+
if (!conv.parselog.empty()) {
string const logfile = infile2 + ".log";
string const script = LibScriptSearch(conv.parselog);
BufferView * bv = buffer->getUser();
if (bv) {
- bv->owner()->prohibitInput();
+ bv->owner()->busy(true);
// all error insets should have been removed by now
}
bv->repaint();
bv->fitCursor();
}
- bv->owner()->allowInput();
+ bv->owner()->busy(false);
}
if ((result & LaTeX::ERRORS)) {
BufferView * bv = buffer->getUser();
if (bv) {
- bv->owner()->prohibitInput();
+ bv->owner()->busy(true);
bv->owner()->message(_("Running LaTeX..."));
// all the autoinsets have already been removed
}
}
if (bv)
- bv->owner()->allowInput();
+ bv->owner()->busy(false);
int const ERROR_MASK =
LaTeX::NO_LOGFILE |