/// 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;
}
<< ' ' << 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;
}
}
bool output_preamble, bool output_body)
{
string const encoding = runparams.encoding->iconvName();
- lyxerr[Debug::LATEX] << "makeLaTeXFile encoding: "
+ 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;
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);
}