/// name of the file the buffer is associated with.
FileName filename;
- Messages * messages;
-
/** Set to true only when the file is fully loaded.
* Used to prevent the premature generation of previews
* and by the citation inset.
Buffer::Impl::Impl(Buffer & parent, FileName const & file, bool readonly_)
: lyx_clean(true), bak_clean(true), unnamed(false), read_only(readonly_),
- filename(file), messages(0), file_fully_loaded(false), inset(params),
+ filename(file), file_fully_loaded(false), inset(params),
toc_backend(&parent)
{
inset.setAutoBreakRows(true);
Buffer::Buffer(string const & file, bool readonly)
: pimpl_(new Impl(*this, FileName(file), readonly))
{
- lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
+ LYXERR(Debug::INFO) << "Buffer::Buffer()" << endl;
}
Buffer::~Buffer()
{
- lyxerr[Debug::INFO] << "Buffer::~Buffer()" << endl;
+ LYXERR(Debug::INFO) << "Buffer::~Buffer()" << endl;
// here the buffer should take care that it is
// saved properly, before it goes into the void.
if (fs::exists(bname.toFilesystemEncoding()) &&
(!fs::exists(fname.toFilesystemEncoding()) ||
fs::last_write_time(fname.toFilesystemEncoding()) < fs::last_write_time(bname.toFilesystemEncoding()))) {
- lyxerr[Debug::FILES] << "Log name calculated as: " << bname << endl;
+ LYXERR(Debug::FILES) << "Log name calculated as: " << bname << endl;
return make_pair(Buffer::buildlog, bname.absFilename());
}
- lyxerr[Debug::FILES] << "Log name calculated as: " << fname << endl;
+ LYXERR(Debug::FILES) << "Log name calculated as: " << fname << endl;
return make_pair(Buffer::latexlog, fname.absFilename());
}
continue;
}
- lyxerr[Debug::PARSER] << "Handling document header token: `"
+ LYXERR(Debug::PARSER) << "Handling document header token: `"
<< token << '\'' << endl;
string unknown = params().readToken(lex, token);
break;
}
- // After we have read a file, we must ensure that the buffer
- // language is set and used in the gui.
- // If you know of a better place to put this, please tell me. (Lgb)
- updateDocLang(params().language);
-
return true;
}
if (readFile(lex, filename) != success)
return false;
- // After we have read a file, we must ensure that the buffer
- // language is set and used in the gui.
- // If you know of a better place to put this, please tell me. (Lgb)
- updateDocLang(params().language);
-
return true;
}
lex.next();
string const token(lex.getString());
- if (!lex.isOK()) {
+ if (!lex) {
Alert::error(_("Document could not be read"),
bformat(_("%1$s could not be read."), from_utf8(filename.absFilename())));
return failure;
<< ' ' << quoteName(filename.toFilesystemEncoding());
string const command_str = command.str();
- lyxerr[Debug::INFO] << "Running '"
+ LYXERR(Debug::INFO) << "Running '"
<< command_str << '\''
<< endl;
bformat(_("Cannot create backup file %1$s.\n"
"Please check whether the directory exists and is writeable."),
from_utf8(backupName.absFilename())));
- lyxerr[Debug::DEBUG] << "Fs error: " << fe.what() << endl;
+ LYXERR(Debug::DEBUG) << "Fs error: " << fe.what() << endl;
}
}
OutputParams const & runparams,
bool output_preamble, bool output_body)
{
- string const encoding = params().encoding().iconvName();
- lyxerr[Debug::LATEX] << "makeLaTeXFile encoding: "
+ string const encoding = runparams.encoding->iconvName();
+ LYXERR(Debug::LATEX) << "makeLaTeXFile encoding: "
<< encoding << "..." << endl;
odocfstream ofs(encoding);
OutputParams runparams = runparams_in;
// validate the buffer.
- lyxerr[Debug::LATEX] << " Validating buffer..." << endl;
+ LYXERR(Debug::LATEX) << " Validating buffer..." << endl;
LaTeXFeatures features(*this, params(), runparams);
validate(features);
- lyxerr[Debug::LATEX] << " Buffer validation done." << endl;
+ LYXERR(Debug::LATEX) << " Buffer validation done." << endl;
texrow().reset();
texrow().newline();
texrow().newline();
}
- lyxerr[Debug::INFO] << "lyx document header finished" << endl;
+ LYXERR(Debug::INFO) << "lyx document header finished" << endl;
// There are a few differences between nice LaTeX and usual files:
// usual is \batchmode and has a
// special input@path to allow the including of figures
os << "\\begin{document}\n";
texrow().newline();
} // output_preamble
- lyxerr[Debug::INFO] << "preamble finished, now the body." << endl;
+ LYXERR(Debug::INFO) << "preamble finished, now the body." << endl;
if (!lyxrc.language_auto_begin) {
// FIXME UNICODE
os << "\\end{document}\n";
texrow().newline();
- lyxerr[Debug::LATEX] << "makeLaTeXFile...done" << endl;
+ LYXERR(Debug::LATEX) << "makeLaTeXFile...done" << endl;
} else {
- lyxerr[Debug::LATEX] << "LaTeXFile for inclusion made."
+ LYXERR(Debug::LATEX) << "LaTeXFile for inclusion made."
<< endl;
}
runparams_in.encoding = runparams.encoding;
// Just to be sure. (Asger)
texrow().newline();
- lyxerr[Debug::INFO] << "Finished making LaTeX file." << endl;
- lyxerr[Debug::INFO] << "Row count was " << texrow().rows() - 1
+ LYXERR(Debug::INFO) << "Finished making LaTeX file." << endl;
+ LYXERR(Debug::INFO) << "Row count was " << texrow().rows() - 1
<< '.' << endl;
}
OutputParams const & runparams,
bool const body_only)
{
- lyxerr[Debug::LATEX] << "makeDocBookFile..." << endl;
+ LYXERR(Debug::LATEX) << "makeDocBookFile..." << endl;
//ofstream ofs;
odocfstream ofs;
busy(true);
// get LaTeX-Filename
- string const path = temppath();
- string const name = addName(path, getLatexName());
+ FileName const path(temppath());
+ string const name = addName(path.absFilename(), getLatexName());
string const org_path = filePath();
support::Path p(path); // path to LaTeX file
// AMS Style is at document level
if (params().use_amsmath == BufferParams::package_on
- || tclass.provides(LyXTextClass::amsmath))
+ || tclass.provides("amsmath"))
features.require("amsmath");
if (params().use_esint == BufferParams::package_on)
features.require("esint");
BOOST_ASSERT(from);
BOOST_ASSERT(to);
- // Take care of l10n/i18n
- updateDocLang(to);
-
for_each(par_iterator_begin(),
par_iterator_end(),
bind(&Paragraph::changeLanguage, _1, params(), from, to));
}
-void Buffer::updateDocLang(Language const * nlang)
-{
- BOOST_ASSERT(nlang);
-
- pimpl_->messages = &getMessages(nlang->code());
-}
-
-
bool Buffer::isMultiLingual() const
{
ParConstIterator end = par_iterator_end();
docstring const Buffer::B_(string const & l10n) const
{
- if (pimpl_->messages)
- return pimpl_->messages->get(l10n);
+ Language const * lang = pimpl_->params.language;
+ if (lang)
+ return getMessages(lang->code()).get(l10n);
return _(l10n);
}