git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3772 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Allan Rae 2002-03-19 03:56:23 +00:00
parent 55bb299483
commit dcebc194f4
4 changed files with 35 additions and 24 deletions

View File

@ -1,3 +1,16 @@
2002-03-19 Allan Rae <rae@lyx.org>
* exporter.C (Export): removeAutoInsets before doing anything else.
While I've just introduced a dependency on BufferView this really is
the best place to clean the buffer otherwise you need to cleanup in
a dozen places before calling export or cleanup in a dozen functions
that export calls.
* converter.C (runLaTeX):
(scanLog): Better handling of removeAutoInsets and screen updates.
* lyxfunc.C (dispatch): small whitespace changes
2002-03-18 Lars Gullik Bjřnnes <larsbj@birdstep.com>
* WorkArea.C (C_WorkAreaEvent): return a value.

View File

@ -783,11 +783,9 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
return false;
BufferView * bv = buffer->getUser();
bool need_redraw = false;
if (bv) {
bv->owner()->prohibitInput();
// Remove all error insets
need_redraw = bv->removeAutoInsets();
// all error insets should have been removed by now
}
LaTeX latex("", filename, "");
@ -797,9 +795,6 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
if ((result & LaTeX::ERRORS)) {
// Insert all errors as errors boxes
bv->insertErrors(terr);
need_redraw = true;
}
if (need_redraw) {
bv->redraw();
bv->fitCursor();
}
@ -839,34 +834,24 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
return false;
BufferView * bv = buffer->getUser();
string name = buffer->getLatexName();
bool need_redraw = false;
if (bv) {
bv->owner()->prohibitInput();
bv->owner()->message(_("Running LaTeX..."));
// Remove all error insets
need_redraw = bv->removeAutoInsets();
// all the autoinsets have already been removed
}
// do the LaTex run(s)
// do the LaTeX run(s)
string name = buffer->getLatexName();
LaTeX latex(command, name, buffer->filePath());
TeXErrors terr;
LaTeX latex(command, name, buffer->filePath());
int result = latex.run(terr,
bv ? bv->owner()->getLyXFunc() : 0);
if (bv) {
if ((result & LaTeX::ERRORS)) {
// Insert all errors as errors boxes
bv->insertErrors(terr);
need_redraw = true;
}
// if we removed error insets before we ran LaTeX or if we inserted
// error insets after we ran LaTeX this must be run:
if (need_redraw) {
bv->redraw();
bv->fitCursor();
}

View File

@ -24,6 +24,7 @@
#include "converter.h"
#include "frontends/Alert.h"
#include "gettext.h"
#include "BufferView.h"
using std::vector;
using std::find;
@ -31,6 +32,18 @@ using std::find;
bool Exporter::Export(Buffer * buffer, string const & format,
bool put_in_tempdir, string & result_file)
{
// There are so many different places that this function can be called
// from that the removal of auto insets is best done here. This ensures
// we always have a clean buffer for inserting errors found during export.
BufferView * bv = buffer->getUser();
if (bv) {
// Remove all error insets
if (bv->removeAutoInsets()) {
bv->redraw();
bv->fitCursor();
}
}
string backend_format;
vector<string> backends = Backends(buffer);
if (find(backends.begin(), backends.end(), format) == backends.end()) {

View File

@ -1098,15 +1098,15 @@ string const LyXFunc::dispatch(kb_action action, string argument)
case LFUN_UPDATE:
Exporter::Export(owner->buffer(), argument, true);
break;
case LFUN_PREVIEW:
Exporter::Preview(owner->buffer(), argument);
break;
case LFUN_BUILDPROG:
Exporter::Export(owner->buffer(), "program", true);
break;
break;
case LFUN_RUNCHKTEX:
MenuRunChktex(owner->buffer());
break;