typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
-void showPrintError(string const & name)
-{
- docstring str = bformat(_("Could not print the document %1$s.\n"
- "Check that your printer is set up correctly."),
- makeDisplayPath(name, 50));
- Alert::error(_("Print document failed"), str);
-}
-
} // namespace anon
{
OutputParams runparams = runparams_in;
- // This is necessary for LuaTeX/XeTeX with tex fonts.
- // See FIXME in BufferParams::encoding()
- if (runparams.isFullUnicode())
- runparams.encoding = encodings.fromLyXName("utf8-plain");
+ // XeTeX with TeX fonts is only safe with ASCII encoding,
+ // See #9740 and FIXME in BufferParams::encoding()
+ if (!params().useNonTeXFonts && (runparams.flavor == OutputParams::XETEX))
+ runparams.encoding = encodings.fromLyXName("ascii");
string const encoding = runparams.encoding->iconvName();
LYXERR(Debug::LATEX, "makeLaTeXFile encoding: " << encoding << ", fname=" << fname.realPath());
OutputParams runparams = runparams_in;
- // This is necessary for LuaTeX/XeTeX with tex fonts.
- // See FIXME in BufferParams::encoding()
- if (runparams.isFullUnicode())
- runparams.encoding = encodings.fromLyXName("utf8-plain");
+ // XeTeX with TeX fonts is only safe with ASCII encoding,
+ // See #9740 and FIXME in BufferParams::encoding()
+ // FIXME: when only the current paragraph is shown, this seems to be ignored:
+ // characters encodable in the current encoding are not converted to ASCII-representation.
+ if (!params().useNonTeXFonts && (runparams.flavor == OutputParams::XETEX))
+ runparams.encoding = encodings.fromLyXName("ascii");
// If we are compiling a file standalone, even if this is the
// child of some other buffer, let's cut the link here, so the
}
os << "\\makeatletter\n"
<< "\\def\\input@path{{"
- << docdir << "/}}\n"
+ << docdir << "}}\n"
<< "\\makeatother\n";
}
}
}
runparams_in.encoding = runparams.encoding;
- // Just to be sure. (Asger)
- os.texrow().newline();
-
- //for (int i = 0; i<d->texrow.rows(); i++) {
- // int id,pos;
- // if (d->texrow.getIdFromRow(i+1,id,pos) && id>0)
- // lyxerr << i+1 << ":" << id << ":" << getParFromID(id).paragraph().asString()<<"\n";
- //}
+ os.texrow().finalize();
LYXERR(Debug::INFO, "Finished making LaTeX file.");
LYXERR(Debug::INFO, "Row count was " << os.texrow().rows() - 1 << '.');
LaTeXFeatures features(*this, params(), runparams);
validate(features);
- d->texrow.reset();
+ d->texrow.reset(false);
DocumentClass const & tclass = params().documentClass();
string const & top_element = tclass.latexname();
}
list.clear();
- Toc & toc = d->toc_backend.toc("label");
- TocIterator toc_it = toc.begin();
- TocIterator end = toc.end();
+ shared_ptr<Toc> toc = d->toc_backend.toc("label");
+ TocIterator toc_it = toc->begin();
+ TocIterator end = toc->end();
for (; toc_it != end; ++toc_it) {
if (toc_it->depth() == 0)
list.push_back(toc_it->str());
break;
case LFUN_BUFFER_VIEW_CACHE:
- enable = (d->preview_file_).exists();
+ (d->preview_file_).refresh();
+ enable = (d->preview_file_).exists() && !(d->preview_file_).isFileEmpty();
break;
+ case LFUN_CHANGES_TRACK:
+ flag.setEnabled(true);
+ flag.setOnOff(params().track_changes);
+ break;
+
+ case LFUN_CHANGES_OUTPUT:
+ flag.setEnabled(true);
+ flag.setOnOff(params().output_changes);
+ break;
+
+ case LFUN_BUFFER_TOGGLE_COMPRESSION: {
+ flag.setOnOff(params().compressed);
+ break;
+ }
+
+ case LFUN_BUFFER_TOGGLE_OUTPUT_SYNC: {
+ flag.setOnOff(params().output_sync);
+ break;
+ }
+
default:
return false;
}
dr.setMessage(_("Error viewing the output file."));
break;
+ case LFUN_CHANGES_TRACK:
+ undo().recordUndoBufferParams(CursorData());
+ params().track_changes = !params().track_changes;
+ break;
+
+ case LFUN_CHANGES_OUTPUT:
+ undo().recordUndoBufferParams(CursorData());
+ params().output_changes = !params().output_changes;
+ if (params().output_changes) {
+ bool dvipost = LaTeXFeatures::isAvailable("dvipost");
+ bool xcolorulem = LaTeXFeatures::isAvailable("ulem") &&
+ LaTeXFeatures::isAvailable("xcolor");
+
+ if (!dvipost && !xcolorulem) {
+ Alert::warning(_("Changes not shown in LaTeX output"),
+ _("Changes will not be highlighted in LaTeX output, "
+ "because neither dvipost nor xcolor/ulem are installed.\n"
+ "Please install these packages or redefine "
+ "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
+ } else if (!xcolorulem) {
+ Alert::warning(_("Changes not shown in LaTeX output"),
+ _("Changes will not be highlighted in LaTeX output "
+ "when using pdflatex, because xcolor and ulem are not installed.\n"
+ "Please install both packages or redefine "
+ "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
+ }
+ }
+ break;
+
+ case LFUN_BUFFER_TOGGLE_COMPRESSION:
+ // turn compression on/off
+ undo().recordUndoBufferParams(CursorData());
+ params().compressed = !params().compressed;
+ break;
+
+ case LFUN_BUFFER_TOGGLE_OUTPUT_SYNC:
+ undo().recordUndoBufferParams(CursorData());
+ params().output_sync = !params().output_sync;
+ break;
+
default:
dispatched = false;
break;
return it->second.second;
static InsetLabel const * dummy_il = 0;
- static References const dummy_refs;
+ static References const dummy_refs = References();
it = d->ref_cache_.insert(
make_pair(label, make_pair(dummy_il, dummy_refs))).first;
return it->second.second;
}
}
-
-void Buffer::getSourceCode(odocstream & os, string const & format,
+// returns NULL if id-to-row conversion is unsupported
+auto_ptr<TexRow> Buffer::getSourceCode(odocstream & os, string const & format,
pit_type par_begin, pit_type par_end,
OutputWhat output, bool master) const
{
+ auto_ptr<TexRow> texrow(NULL);
OutputParams runparams(¶ms().encoding());
runparams.nice = true;
runparams.flavor = params().getOutputFlavor(format);
LaTeXFeatures features(*this, params(), runparams);
params().validate(features);
runparams.use_polyglossia = features.usePolyglossia();
- TexRow texrow;
- texrow.reset();
- texrow.newline();
- texrow.newline();
+ texrow.reset(new TexRow());
+ texrow->newline();
+ texrow->newline();
// latex or literate
- otexstream ots(os, texrow);
+ otexstream ots(os, *texrow);
// the real stuff
latexParagraphs(*this, text(), ots, runparams);
+ texrow->finalize();
// Restore the parenthood
if (!master)
writeDocBookSource(os, absFileName(), runparams, output);
} else {
// latex or literate
- d->texrow.reset();
- d->texrow.newline();
- d->texrow.newline();
- otexstream ots(os, d->texrow);
+ texrow.reset(new TexRow());
+ texrow->newline();
+ texrow->newline();
+ otexstream ots(os, *texrow);
if (master)
runparams.is_child = true;
writeLaTeXSource(ots, string(), runparams, output);
+ texrow->finalize();
}
}
+ return texrow;
}
d->bibinfo_cache_valid_ = true;
d->cite_labels_valid_ = true;
- cbuf.tocBackend().update(utype == OutputUpdate);
+ /// FIXME: Perf
+ cbuf.tocBackend().update(true, utype);
if (scope == UpdateMaster)
cbuf.structureChanged();
}
// old_position already contains a trailing path separator
string const absname = isabsolute ? name : d->old_position + name;
- if (d->old_position.empty() || d->old_position == filePath()
+ if (d->old_position.empty()
+ || equivalent(FileName(d->old_position), FileName(filePath()))
|| !FileName(addExtension(absname, ext)).exists())
return name;