#include "CutAndPaste.h"
#include "DispatchResult.h"
#include "DocIterator.h"
-#include "Encoding.h"
+#include "BufferEncodings.h"
#include "ErrorList.h"
#include "Exporter.h"
#include "Format.h"
CloneList * clone_list_;
/// are we in the process of exporting this buffer?
mutable bool doing_export;
-
+
/// compute statistics
/// \p from initial position
/// \p to points to the end position
}
}
- if (!params().master.empty()) {
+ if (!parent() && !params().master.empty()) {
FileName const master_file = makeAbsPath(params().master,
onlyPath(absFileName()));
if (isLyXFileName(master_file.absFileName())) {
// The top of the file should not be written by params().
// write out a comment in the top of the file
+ // Important: Keep the version formatting in sync with lyx2lyx and
+ // tex2lyx (bug 7951)
ofs << "#LyX " << lyx_version_major << "." << lyx_version_minor
<< " created this file. For more info see http://www.lyx.org/\n"
<< "\\lyxformat " << LYX_FORMAT << "\n"
lyxerr << "File '" << fname << "' was not closed properly." << endl;
}
- errors("Export");
+ if (runparams_in.silent)
+ errorList.clear();
+ else
+ errors("Export");
return !failed_export;
}
d->ignore_parent = true;
// Classify the unicode characters appearing in math insets
- Encodings::initUnicodeMath(*this);
+ BufferEncodings::initUnicodeMath(*this);
// validate the buffer.
LYXERR(Debug::LATEX, " Validating buffer...");
LaTeXFeatures features(*this, params(), runparams);
validate(features);
- runparams.use_polyglossia = features.usePolyglossia();
+ // This is only set once per document (in master)
+ if (!runparams.is_child)
+ runparams.use_polyglossia = features.usePolyglossia();
LYXERR(Debug::LATEX, " Buffer validation done.");
bool const output_preamble =
runparams.use_babel = params().writeLaTeX(os, features,
d->filename.onlyPath());
- runparams.use_japanese = features.isRequired("japanese");
+ // Japanese might be required only in some children of a document,
+ // but once required, we must keep use_japanese true.
+ runparams.use_japanese |= features.isRequired("japanese");
if (!output_body) {
// Restore the parenthood if needed
if (output_preamble) {
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN\" \"http://www.w3.org/TR/2001/REC-MathML2-20010221/dtd/xhtml-math11-f.dtd\">\n"
+ << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN\" \"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd\">\n"
// FIXME Language should be set properly.
<< "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
<< "<head>\n"
<< ";\n";
css << "}\n";
}
-
+
docstring const dstyles = css.str();
if (!dstyles.empty()) {
bool written = false;
setBusy(false);
- errors("ChkTeX");
+ if (runparams.silent)
+ d->errorLists["ChkTeX"].clear();
+ else
+ errors("ChkTeX");
return res;
}
break;
}
- case LFUN_BUILD_PROGRAM:
- doExport("program", true);
+ case LFUN_BUILD_PROGRAM: {
+ ExportStatus const status = doExport("program", true);
+ dr.setError(status != ExportSuccess);
+ if (status != ExportSuccess)
+ dr.setMessage(_("Error generating literate programming code."));
break;
+ }
case LFUN_BUFFER_CHKTEX:
runChktex();
msg += ("\n");
msg += bformat(_("Branch \"%1$s\" already exists."), branch_name);
} else {
+ undo().recordUndoFullDocument(CursorData());
branch_list.add(branch_name);
branch = branch_list.find(branch_name);
string const x11hexname = X11hexname(branch->color());
break;
}
- if (!doExport("dvi", true)) {
+ if (doExport("dvi", true) != ExportSuccess) {
showPrintError(absFileName());
dr.setMessage(_("Error exporting to DVI."));
break;
string const paramName = "key";
for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
- if (it->lyxCode() != CITE_CODE)
+ if (it->lyxCode() != CITE_CODE)
continue;
InsetCommand * inset = it->asInsetCommand();
docstring const oldValue = inset->getParam(paramName);
// Emit the signal to show the error list or copy it back to the
// cloned Buffer so that it can be emitted afterwards.
if (format != backend_format) {
- if (d->cloned_buffer_) {
+ if (runparams.silent)
+ error_list.clear();
+ else if (d->cloned_buffer_)
d->cloned_buffer_->d->errorLists[error_type] =
d->errorLists[error_type];
- } else
+ else
errors(error_type);
// also to the children, in case of master-buffer-view
ListOfBuffers clist = getDescendents();
ListOfBuffers::const_iterator cit = clist.begin();
ListOfBuffers::const_iterator const cen = clist.end();
for (; cit != cen; ++cit) {
- if (d->cloned_buffer_) {
+ if (runparams.silent)
+ (*cit)->d->errorLists[error_type].clear();
+ else if (d->cloned_buffer_) {
// Enable reverse search by copying back the
// texrow object to the cloned buffer.
// FIXME: this is not thread safe.
word_count_ = 0;
char_count_ = 0;
blank_count_ = 0;
-
+
for (DocIterator dit = from ; dit != to && !dit.atEnd(); ) {
if (!dit.inTexted()) {
dit.forwardPos();
continue;
}
-
+
Paragraph const & par = dit.paragraph();
pos_type const pos = dit.pos();
-
+
// Copied and adapted from isWordSeparator() in Paragraph
if (pos == dit.lastpos()) {
inword = false;
break;
continue;
} else if (!par.isDeleted(pos)) {
- if (par.isWordSeparator(pos))
+ if (par.isWordSeparator(pos))
inword = false;
else if (!inword) {
++word_count_;
}
-Buffer::ReadStatus Buffer::reload(bool clearUndo)
+Buffer::ReadStatus Buffer::reload()
{
setBusy(true);
// c.f. bug http://www.lyx.org/trac/ticket/6587
updateTitles();
markClean();
message(bformat(_("Document %1$s reloaded."), disp_fn));
- if (clearUndo)
- d->undo_.clear();
+ d->undo_.clear();
} else {
message(bformat(_("Could not reload document %1$s."), disp_fn));
}