Buffer::Buffer(string const & file, bool readonly)
: pimpl_(new Impl(*this, FileName(file), readonly)), gui_(0)
{
- LYXERR(Debug::INFO) << "Buffer::Buffer()" << endl;
+ LYXERR(Debug::INFO, "Buffer::Buffer()");
}
Buffer::~Buffer()
{
- LYXERR(Debug::INFO) << "Buffer::~Buffer()" << endl;
+ LYXERR(Debug::INFO, "Buffer::~Buffer()");
// here the buffer should take care that it is
// saved properly, before it goes into the void.
if (bname.exists() &&
(!fname.exists() || fname.lastModified() < bname.lastModified())) {
- LYXERR(Debug::FILES) << "Log name calculated as: " << bname << endl;
+ LYXERR(Debug::FILES, "Log name calculated as: " << bname);
if (type)
*type = buildlog;
return bname.absFilename();
}
- LYXERR(Debug::FILES) << "Log name calculated as: " << fname << endl;
+ LYXERR(Debug::FILES, "Log name calculated as: " << fname);
if (type)
*type = latexlog;
return fname.absFilename();
continue;
}
- LYXERR(Debug::PARSER) << "Handling document header token: `"
- << token << '\'' << endl;
+ LYXERR(Debug::PARSER, "Handling document header token: `"
+ << token << '\'');
string unknown = params().readToken(lex, token);
if (!unknown.empty()) {
string format = filename.guessFormatFromContents();
if (format == "zip") {
// decompress to a temp directory
- LYXERR(Debug::FILES) << filename << " is in zip format. Unzip to " << temppath() << endl;
+ LYXERR(Debug::FILES, filename << " is in zip format. Unzip to " << temppath());
::unzipToDir(filename.toFilesystemEncoding(), temppath());
//
FileName lyxfile(addName(temppath(), "content.lyx"));
<< ' ' << quoteName(filename.toFilesystemEncoding());
string const command_str = command.str();
- LYXERR(Debug::INFO) << "Running '"
- << command_str << '\''
- << endl;
+ LYXERR(Debug::INFO, "Running '" << command_str << '\'');
cmd_ret const ret = runCommand(command_str);
if (ret.first != 0) {
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());
}
}
bool output_preamble, bool output_body)
{
string const encoding = runparams.encoding->iconvName();
- LYXERR(Debug::LATEX) << "makeLaTeXFile encoding: "
- << encoding << "..." << endl;
+ LYXERR(Debug::LATEX, "makeLaTeXFile encoding: " << encoding << "...");
odocfstream ofs(encoding);
if (!openFileWrite(ofs, fname))
OutputParams runparams = runparams_in;
// validate the buffer.
- LYXERR(Debug::LATEX) << " Validating buffer..." << endl;
+ LYXERR(Debug::LATEX, " Validating buffer...");
LaTeXFeatures features(*this, params(), runparams);
validate(features);
- LYXERR(Debug::LATEX) << " Buffer validation done." << endl;
+ LYXERR(Debug::LATEX, " Buffer validation done.");
// The starting paragraph of the coming rows is the
// first paragraph of the document. (Asger)
texrow().newline();
texrow().newline();
}
- LYXERR(Debug::INFO) << "lyx document header finished" << endl;
+ LYXERR(Debug::INFO, "lyx document header finished");
// 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
texrow().start(paragraphs().begin()->id(), 0);
- LYXERR(Debug::INFO) << "preamble finished, now the body." << endl;
+ LYXERR(Debug::INFO, "preamble finished, now the body.");
if (!lyxrc.language_auto_begin &&
!params().language->babel().empty()) {
if (output_preamble) {
os << "\\end{document}\n";
texrow().newline();
-
- LYXERR(Debug::LATEX) << "makeLaTeXFile...done" << endl;
+ LYXERR(Debug::LATEX, "makeLaTeXFile...done");
} else {
- LYXERR(Debug::LATEX) << "LaTeXFile for inclusion made."
- << endl;
+ LYXERR(Debug::LATEX, "LaTeXFile for inclusion made.");
}
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
- << '.' << endl;
+ LYXERR(Debug::INFO, "Finished making LaTeX file.");
+ LYXERR(Debug::INFO, "Row count was " << texrow().rows() - 1 << '.');
}
OutputParams const & runparams,
bool const body_only)
{
- LYXERR(Debug::LATEX) << "makeDocBookFile..." << endl;
+ LYXERR(Debug::LATEX, "makeDocBookFile...");
//ofstream ofs;
odocfstream ofs;
{
auto_ptr<Buffer> tmpbuf(new Buffer(s, ronly));
tmpbuf->params().useClassDefaults();
- LYXERR(Debug::INFO) << "Assigning to buffer "
- << bstore.size() << endl;
+ LYXERR(Debug::INFO, "Assigning to buffer " << bstore.size());
bstore.push_back(tmpbuf.get());
return tmpbuf.release();
}
// causes screen update(), I reset last_inset_ to avoid such a problem.
d->last_inset_ = 0;
// This is close to a hot-path.
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::DEBUG, "BufferView::processUpdateFlags()"
<< "[fitcursor = " << (flags & Update::FitCursor)
<< ", forceupdate = " << (flags & Update::Force)
<< ", singlepar = " << (flags & Update::SinglePar)
- << "] buffer: " << &buffer_ << endl;
+ << "] buffer: " << &buffer_);
// Update macro store
if (!(cursor().inMathed() && cursor().inMacroMode()))
d->offset_ref_ = 0;
}
- LYXERR(Debug::GUI)
- << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::GUI, BOOST_CURRENT_FUNCTION
<< " Updating scrollbar: height: " << t.paragraphs().size()
<< " curr par: " << d->cursor_.bottom().pit()
- << " default height " << defaultRowHeight() << endl;
+ << " default height " << defaultRowHeight());
// It would be better to fix the scrollbar to understand
// values in [0..1] and divide everything by wh
void BufferView::scrollDocView(int value)
{
- LYXERR(Debug::GUI) << BOOST_CURRENT_FUNCTION
- << "[ value = " << value << "]" << endl;
+ LYXERR(Debug::GUI, BOOST_CURRENT_FUNCTION << "[ value = " << value << "]");
Text & t = buffer_.text();
TextMetrics & tm = d->text_metrics_[&t];
// << [ cmd = " << cmd << "]" << endl;
// Make sure that the cached BufferView is correct.
- LYXERR(Debug::ACTION) << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::ACTION, BOOST_CURRENT_FUNCTION
<< " action[" << cmd.action << ']'
<< " arg[" << to_utf8(cmd.argument()) << ']'
<< " x[" << cmd.x << ']'
<< " y[" << cmd.y << ']'
- << " button[" << cmd.button() << ']'
- << endl;
+ << " button[" << cmd.button() << ']');
Cursor & cur = d->cursor_;
// Default Update flags.
ParIterator par = b->getParFromID(id);
if (par == b->par_iterator_end()) {
- LYXERR(Debug::INFO)
- << "No matching paragraph found! ["
- << id << "]." << endl;
+ LYXERR(Debug::INFO, "No matching paragraph found! [" << id << "].");
} else {
- LYXERR(Debug::INFO)
- << "Paragraph " << par->id()
+ LYXERR(Debug::INFO, "Paragraph " << par->id()
<< " found in buffer `"
- << b->absFileName() << "'." << endl;
+ << b->absFileName() << "'.");
if (b == &buffer_) {
// Set the cursor
// Reinitialize anchor to first pit.
d->anchor_ref_ = firstpm.first;
d->offset_ref_ = -y1;
- LYXERR(Debug::PAINTING)
- << "Mouse hover detected at: (" << cmd.x << ", " << cmd.y << ")"
+ LYXERR(Debug::PAINTING,
+ "Mouse hover detected at: (" << cmd.x << ", " << cmd.y << ")"
<< "\nTriggering redraw: y1: " << y1 << " y2: " << y2
- << " pit1: " << firstpm.first << " pit2: " << lastpm.first << endl;
+ << " pit1: " << firstpm.first << " pit2: " << lastpm.first);
// This event (moving without mouse click) is not passed further.
// This should be changed if it is further utilized.
int y2 = pm.position() + pm.descent();
d->metrics_info_ = ViewMetricsInfo(bottom_pit, bottom_pit, y1, y2,
SingleParUpdate, buftext.paragraphs().size());
- LYXERR(Debug::PAINTING)
- << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::PAINTING, BOOST_CURRENT_FUNCTION
<< "\ny1: " << y1
<< " y2: " << y2
<< " pit: " << bottom_pit
- << " singlepar: 1"
- << endl;
+ << " singlepar: 1");
return true;
}
// Take care of descent of last line
y2 += tm.parMetrics(pit2).descent();
- LYXERR(Debug::PAINTING)
- << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::PAINTING, BOOST_CURRENT_FUNCTION
<< "\n y1: " << y1
<< " y2: " << y2
<< " pit1: " << pit1
<< " pit2: " << pit2
<< " npit: " << npit
- << " singlepar: 0"
- << endl;
+ << " singlepar: 0");
d->metrics_info_ = ViewMetricsInfo(pit1, pit2, y1, y2,
FullScreenUpdate, npit);
if (lyxerr.debugging(Debug::WORKAREA)) {
- LYXERR(Debug::WORKAREA) << "BufferView::updateMetrics" << endl;
+ LYXERR(Debug::WORKAREA, "BufferView::updateMetrics");
d->coord_cache_.dump();
}
}
void BufferView::draw(frontend::Painter & pain)
{
- LYXERR(Debug::PAINTING) << "\t\t*** START DRAWING ***" << endl;
+ LYXERR(Debug::PAINTING, "\t\t*** START DRAWING ***");
Text & text = buffer_.text();
TextMetrics const & tm = d->text_metrics_[&text];
int const y = d->metrics_info_.y1
break;
}
- LYXERR(Debug::PAINTING) << "\n\t\t*** END DRAWING ***" << endl;
+ LYXERR(Debug::PAINTING, "\n\t\t*** END DRAWING ***");
}
void Changes::set(Change const & change, pos_type const start, pos_type const end)
{
if (change.type != Change::UNCHANGED) {
- LYXERR(Debug::CHANGES) << "setting change (type: " << change.type
+ LYXERR(Debug::CHANGES, "setting change (type: " << change.type
<< ", author: " << change.author << ", time: " << change.changetime
- << ") in range (" << start << ", " << end << ")" << endl;
+ << ") in range (" << start << ", " << end << ")");
}
Range const newRange(start, end);
pos_type oldEnd = it->range.end;
it->range.end = start;
- LYXERR(Debug::CHANGES) << " cutting tail of type " << it->change.type
+ LYXERR(Debug::CHANGES, " cutting tail of type " << it->change.type
<< " resulting in range (" << it->range.start << ", "
- << it->range.end << ")" << endl;
+ << it->range.end << ")");
++it;
if (oldEnd >= end) {
- LYXERR(Debug::CHANGES) << " inserting tail in range ("
- << end << ", " << oldEnd << ")" << endl;
+ LYXERR(Debug::CHANGES, " inserting tail in range ("
+ << end << ", " << oldEnd << ")");
it = table_.insert(it, ChangeRange((it-1)->change, Range(end, oldEnd)));
}
continue;
}
if (change.type != Change::UNCHANGED) {
- LYXERR(Debug::CHANGES) << " inserting change" << endl;
+ LYXERR(Debug::CHANGES, " inserting change");
it = table_.insert(it, ChangeRange(change, Range(start, end)));
++it;
}
for (; it != table_.end(); ) {
// new change 'contains' existing change
if (newRange.contains(it->range)) {
- LYXERR(Debug::CHANGES) << " removing subrange ("
- << it->range.start << ", " << it->range.end << ")" << endl;
+ LYXERR(Debug::CHANGES, " removing subrange ("
+ << it->range.start << ", " << it->range.end << ")");
it = table_.erase(it);
continue;
}
// new change intersects with existing change
it->range.start = end;
- LYXERR(Debug::CHANGES) << " cutting head of type "
+ LYXERR(Debug::CHANGES, " cutting head of type "
<< it->change.type << " resulting in range ("
- << end << ", " << it->range.end << ")" << endl;
+ << end << ", " << it->range.end << ")");
break; // no need for another iteration
}
void Changes::erase(pos_type const pos)
{
- LYXERR(Debug::CHANGES) << "Erasing change at position " << pos << endl;
+ LYXERR(Debug::CHANGES, "Erasing change at position " << pos);
ChangeTable::iterator it = table_.begin();
ChangeTable::iterator end = table_.end();
void Changes::insert(Change const & change, lyx::pos_type pos)
{
if (change.type != Change::UNCHANGED) {
- LYXERR(Debug::CHANGES) << "Inserting change of type " << change.type
- << " at position " << pos << endl;
+ LYXERR(Debug::CHANGES, "Inserting change of type " << change.type
+ << " at position " << pos);
}
ChangeTable::iterator it = table_.begin();
for (; it != itend; ++it) {
if (it->range.intersects(Range(start, end))) {
- LYXERR(Debug::CHANGES) << "found intersection of range ("
+ LYXERR(Debug::CHANGES, "found intersection of range ("
<< start << ", " << end << ") with ("
<< it->range.start << ", " << it->range.end
- << ") of type " << it->change.type << endl;
+ << ") of type " << it->change.type);
return true;
}
}
ChangeTable::iterator it = table_.begin();
while (it != table_.end()) {
- LYXERR(Debug::CHANGES) << "found change of type " << it->change.type
+ LYXERR(Debug::CHANGES, "found change of type " << it->change.type
<< " and range (" << it->range.start << ", " << it->range.end
- << ")" << endl;
+ << ")");
if (it->range.start == it->range.end) {
- LYXERR(Debug::CHANGES) << "removing empty range for pos "
- << it->range.start << endl;
+ LYXERR(Debug::CHANGES, "removing empty range for pos "
+ << it->range.start);
table_.erase(it);
// start again
if (it + 1 == table_.end())
break;
- if (it->change.isSimilarTo((it + 1)->change) && it->range.end == (it + 1)->range.start) {
- LYXERR(Debug::CHANGES) << "merging ranges (" << it->range.start << ", "
+ if (it->change.isSimilarTo((it + 1)->change)
+ && it->range.end == (it + 1)->range.start) {
+ LYXERR(Debug::CHANGES, "merging ranges (" << it->range.start << ", "
<< it->range.end << ") and (" << (it + 1)->range.start << ", "
- << (it + 1)->range.end << ")" << endl;
+ << (it + 1)->range.end << ")");
(it + 1)->range.start = it->range.start;
(it + 1)->change.changetime = max(it->change.changetime,
return false;
}
-// LYXERR(Debug::KBMAP) << "Reading def file:" << tmp << endl;
+ //LYXERR(Debug::KBMAP, "Reading def file:" << tmp);
bool error = false;
while (lexrc.isOK()) {
{
string const lcname = ascii_lowercase(lyxname);
if (lyxcolors.find(lcname) == lyxcolors.end()) {
- LYXERR(Debug::GUI)
- << "ColorSet::setColor: Unknown color \""
- << lyxname << '"' << endl;
+ LYXERR(Debug::GUI, "ColorSet::setColor: Unknown color \""
+ << lyxname << '"');
addColor(static_cast<ColorCode>(infotab.size()), lcname);
}
#include "support/Path.h"
#include "support/Systemcall.h"
-using std::endl;
using std::find_if;
using std::string;
using std::vector;
quoteName(from_ext + ':' + from_file.toFilesystemEncoding()) +
' ' +
quoteName(to_ext + ':' + to_file.toFilesystemEncoding());
- LYXERR(Debug::FILES)
- << "No converter defined! "
- "I use convertDefault.py:\n\t"
- << command << endl;
+ LYXERR(Debug::FILES, "No converter defined! "
+ "I use convertDefault.py:\n\t" << command);
Systemcall one;
one.startscript(Systemcall::Wait, command);
if (to_file.isFileReadable()) {
Converter const & conv = converterlist_[*cit];
bool dummy = conv.To->dummy() && conv.to != "program";
if (!dummy) {
- LYXERR(Debug::FILES) << "Converting from "
- << conv.from << " to " << conv.to << endl;
+ LYXERR(Debug::FILES, "Converting from "
+ << conv.from << " to " << conv.to);
}
infile = outfile;
outfile = FileName(conv.result_dir.empty()
if (conv.latex) {
run_latex = true;
string const command = subst(conv.command, token_from, "");
- LYXERR(Debug::FILES) << "Running " << command << endl;
+ LYXERR(Debug::FILES, "Running " << command);
if (!runLaTeX(*buffer, command, runparams, errorList))
return false;
} else {
if (conv.need_aux && !run_latex
&& !latex_command_.empty()) {
- LYXERR(Debug::FILES)
- << "Running " << latex_command_
- << " to update aux file"<< endl;
+ LYXERR(Debug::FILES, "Running " << latex_command_
+ << " to update aux file");
runLaTeX(*buffer, latex_command_, runparams, errorList);
}
command = add_options(command,
dvipdfm_options(buffer->params()));
- LYXERR(Debug::FILES) << "Calling " << command << endl;
+ LYXERR(Debug::FILES, "Calling " << command);
if (buffer)
buffer->message(_("Executing command: ")
+ from_utf8(command));
if (!mover.rename(outfile, real_outfile))
res = -1;
else
- LYXERR(Debug::FILES)
- << "renaming file " << outfile
- << " to " << real_outfile
- << endl;
+ LYXERR(Debug::FILES, "renaming file " << outfile
+ << " to " << real_outfile);
// Finally, don't forget to tell any future
// converters to use the renamed file...
outfile = real_outfile;
string const to2 = changeExtension(
to_base + file2.substr(base.length()),
to_extension);
- LYXERR(Debug::FILES) << "moving " << from2
- << " to " << to2 << endl;
+ LYXERR(Debug::FILES, "moving " << from2 << " to " << to2);
Mover const & mover = getMover(fmt);
bool const moved = copy
os << std::setw(10) << std::setfill('0') << do_crc(orig_from.absFilename())
<< '-' << to_format;
cache_name = FileName(addName(cache_dir.absFilename(), os.str()));
- LYXERR(Debug::FILES) << "Add file cache item " << orig_from
+ LYXERR(Debug::FILES, "Add file cache item " << orig_from
<< ' ' << to_format << ' ' << cache_name
- << ' ' << timestamp << ' ' << checksum
- << '.' << std::endl;
+ << ' ' << timestamp << ' ' << checksum << '.');
}
~CacheItem() {}
FileName cache_name;
// Don't cache files that do not exist anymore
if (!orig_from_name.exists()) {
- LYXERR(Debug::FILES) << "Not caching file `"
- << orig_from << "' (does not exist anymore)."
- << std::endl;
+ LYXERR(Debug::FILES, "Not caching file `"
+ << orig_from << "' (does not exist anymore).");
support::unlink(item.cache_name);
continue;
}
// This can happen if two instances of LyX are running
// at the same time and update the index file independantly.
if (!item.cache_name.exists()) {
- LYXERR(Debug::FILES) << "Not caching file `"
- << orig_from
- << "' (cached copy does not exist anymore)."
- << std::endl;
+ LYXERR(Debug::FILES, "Not caching file `" << orig_from
+ << "' (cached copy does not exist anymore).");
continue;
}
// Delete the cached file if it is too old
if (difftime(now, item.cache_name.lastModified())
> lyxrc.converter_cache_maxage) {
- LYXERR(Debug::FILES) << "Not caching file `"
- << orig_from << "' (too old)." << std::endl;
+ LYXERR(Debug::FILES, "Not caching file `"
+ << orig_from << "' (too old).");
support::unlink(item.cache_name);
continue;
}
if (!lyxrc.use_converter_cache || orig_from.empty() ||
converted_file.empty())
return;
- LYXERR(Debug::FILES) << BOOST_CURRENT_FUNCTION << ' ' << orig_from
- << ' ' << to_format << ' ' << converted_file
- << std::endl;
+ LYXERR(Debug::FILES, BOOST_CURRENT_FUNCTION << ' ' << orig_from
+ << ' ' << to_format << ' ' << converted_file);
// FIXME: Should not hardcode this (see bug 3819 for details)
if (to_format == "pstex") {
time_t const timestamp = orig_from.lastModified();
Mover const & mover = getMover(to_format);
if (item) {
- LYXERR(Debug::FILES) << "ConverterCache::add(" << orig_from << "):\n"
- "The file is already in the cache."
- << std::endl;
+ LYXERR(Debug::FILES, "ConverterCache::add(" << orig_from << "):\n"
+ "The file is already in the cache.");
// First test for timestamp
if (timestamp == item->timestamp) {
- LYXERR(Debug::FILES) << "Same timestamp."
- << std::endl;
+ LYXERR(Debug::FILES, "Same timestamp.");
+ return;
+ }
+ // Maybe the contents is still the same?
+ item->timestamp = timestamp;
+ unsigned long const checksum = support::sum(orig_from);
+ if (checksum == item->checksum) {
+ LYXERR(Debug::FILES, "Same checksum.");
return;
- } else {
- // Maybe the contents is still the same?
- item->timestamp = timestamp;
- unsigned long const checksum = support::sum(orig_from);
- if (checksum == item->checksum) {
- LYXERR(Debug::FILES) << "Same checksum."
- << std::endl;
- return;
- }
- item->checksum = checksum;
}
+ item->checksum = checksum;
if (!mover.copy(converted_file, item->cache_name,
support::onlyFilename(item->cache_name.absFilename()), 0600)) {
- LYXERR(Debug::FILES) << "ConverterCache::add("
- << orig_from << "):\n"
- "Could not copy file."
- << std::endl;
+ LYXERR(Debug::FILES, "ConverterCache::add(" << orig_from << "):\n"
+ "Could not copy file.");
}
} else {
CacheItem new_item(orig_from, to_format, timestamp,
formats.getFormatFromFile(orig_from);
format_cache.cache[to_format] = new_item;
} else
- LYXERR(Debug::FILES) << "ConverterCache::add("
- << orig_from << "):\n"
- "Could not copy file."
- << std::endl;
+ LYXERR(Debug::FILES, "ConverterCache::add(" << orig_from << "):\n"
+ "Could not copy file.");
}
}
{
if (!lyxrc.use_converter_cache || orig_from.empty())
return;
- LYXERR(Debug::FILES) << BOOST_CURRENT_FUNCTION << ' ' << orig_from
- << ' ' << to_format << std::endl;
+ LYXERR(Debug::FILES, BOOST_CURRENT_FUNCTION << ' ' << orig_from
+ << ' ' << to_format);
CacheType::iterator const it1 = pimpl_->cache.find(orig_from);
if (it1 == pimpl_->cache.end())
FormatCacheType::iterator it2 = format_cache.begin();
while (it2 != format_cache.end()) {
if (it2->first == to_format) {
- LYXERR(Debug::FILES)
- << "Removing file cache item "
- << it1->first
- << ' ' << to_format << std::endl;
+ LYXERR(Debug::FILES, "Removing file cache item "
+ << it1->first << ' ' << to_format);
support::unlink(it2->second.cache_name);
format_cache.erase(it2);
// Have to start over again since items in a
// map are not ordered
it2 = format_cache.begin();
- } else
+ } else {
++it2;
+ }
}
if (format_cache.empty()) {
pimpl_->cache.erase(it1);
// Have to start over again since items in a map are
// not ordered
it1 = pimpl_->cache.begin();
- } else
+ } else {
++it1;
+ }
}
pimpl_->writeIndex();
}
{
if (!lyxrc.use_converter_cache || orig_from.empty())
return false;
- LYXERR(Debug::FILES) << BOOST_CURRENT_FUNCTION << ' ' << orig_from
- << ' ' << to_format << std::endl;
+ LYXERR(Debug::FILES, BOOST_CURRENT_FUNCTION << ' ' << orig_from
+ << ' ' << to_format);
CacheItem * const item = pimpl_->find(orig_from, to_format);
if (!item) {
- LYXERR(Debug::FILES) << "not in cache." << std::endl;
+ LYXERR(Debug::FILES, "not in cache.");
return false;
}
time_t const timestamp = orig_from.lastModified();
if (item->timestamp == timestamp) {
- LYXERR(Debug::FILES) << "identical timestamp." << std::endl;
+ LYXERR(Debug::FILES, "identical timestamp.");
return true;
}
if (item->checksum == support::sum(orig_from)) {
item->timestamp = timestamp;
- LYXERR(Debug::FILES) << "identical checksum." << std::endl;
+ LYXERR(Debug::FILES, "identical checksum.");
return true;
}
- LYXERR(Debug::FILES) << "in cache, but too old." << std::endl;
+ LYXERR(Debug::FILES, "in cache, but too old.");
return false;
}
FileName const & ConverterCache::cacheName(FileName const & orig_from,
string const & to_format) const
{
- LYXERR(Debug::FILES) << BOOST_CURRENT_FUNCTION << ' ' << orig_from
- << ' ' << to_format << std::endl;
+ LYXERR(Debug::FILES, BOOST_CURRENT_FUNCTION << ' ' << orig_from
+ << ' ' << to_format);
CacheItem * const item = pimpl_->find(orig_from, to_format);
BOOST_ASSERT(item);
{
if (!lyxrc.use_converter_cache || orig_from.empty() || dest.empty())
return false;
- LYXERR(Debug::FILES) << BOOST_CURRENT_FUNCTION << ' ' << orig_from
- << ' ' << to_format << ' ' << dest << std::endl;
+ LYXERR(Debug::FILES, BOOST_CURRENT_FUNCTION << ' ' << orig_from
+ << ' ' << to_format << ' ' << dest);
// FIXME: Should not hardcode this (see bug 3819 for details)
if (to_format == "pstex") {
double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
// '<=' in order to take the last possible position
// this is important for clicking behind \sum in e.g. '\sum_i a'
- LYXERR(Debug::DEBUG) << "i: " << i << " d: " << d
- << " best: " << best_dist << endl;
+ LYXERR(Debug::DEBUG, "i: " << i << " d: " << d
+ << " best: " << best_dist);
if (d <= best_dist) {
best_dist = d;
result = it;
void Cursor::dispatch(FuncRequest const & cmd0)
{
- LYXERR(Debug::DEBUG) << BOOST_CURRENT_FUNCTION
- << " cmd: " << cmd0 << '\n'
- << *this << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << " cmd: " << cmd0 << '\n' << *this);
if (empty())
return;
getPos(beforeDispX_, beforeDispY_);
beforeDispatchCursor_ = *this;
for (; depth(); pop()) {
- LYXERR(Debug::DEBUG) << "Cursor::dispatch: cmd: "
- << cmd0 << endl << *this << endl;
+ LYXERR(Debug::DEBUG, "Cursor::dispatch: cmd: "
+ << cmd0 << endl << *this);
BOOST_ASSERT(pos() <= lastpos());
BOOST_ASSERT(idx() <= lastidx());
BOOST_ASSERT(pit() <= lastpit());
// it completely to get a 'bomb early' behaviour in case this
// object will be used again.
if (!disp_.dispatched()) {
- LYXERR(Debug::DEBUG) << "RESTORING OLD CURSOR!" << endl;
+ LYXERR(Debug::DEBUG, "RESTORING OLD CURSOR!");
operator=(safe);
disp_.update(Update::None);
disp_.dispatched(false);
void Cursor::handleFont(string const & font)
{
- LYXERR(Debug::DEBUG) << BOOST_CURRENT_FUNCTION << ": " << font << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << ": " << font);
docstring safe;
if (selection()) {
macroModeClose();
if (cur.selection()
&& cur.selBegin() == cur.bv().cursor().selBegin()
&& cur.selEnd() == cur.bv().cursor().selEnd()) {
- LYXERR(Debug::ACTION) << BOOST_CURRENT_FUNCTION << ": `"
- << to_utf8(cur.selectionAsString(true)) << "'."
- << endl;
+ LYXERR(Debug::ACTION, BOOST_CURRENT_FUNCTION << ": `"
+ << to_utf8(cur.selectionAsString(true)) << "'.");
copySelectionToStack(cur, selectionBuffer);
}
}
dep_info di;
di.crc_prev = 0;
if (upd) {
- LYXERR(Debug::DEPEND) << " CRC..." << flush;
+ LYXERR(Debug::DEPEND, " CRC...");
di.crc_cur = sum(f);
- LYXERR(Debug::DEPEND) << "done." << endl;
+ LYXERR(Debug::DEPEND, "done.");
struct stat f_info;
stat(f.toFilesystemEncoding().c_str(), &f_info);
di.mtime_cur = long(f_info.st_mtime);
}
deplist[f] = di;
} else {
- LYXERR(Debug::DEPEND) << " Already in DepTable" << endl;
+ LYXERR(Debug::DEPEND, " Already in DepTable");
}
}
void DepTable::update()
{
- LYXERR(Debug::DEPEND) << "Updating DepTable..." << endl;
+ LYXERR(Debug::DEPEND, "Updating DepTable...");
time_type const start_time = current_time();
DepList::iterator itr = deplist.begin();
if (stat(itr->first.toFilesystemEncoding().c_str(), &f_info) == 0) {
if (di.mtime_cur == f_info.st_mtime) {
di.crc_prev = di.crc_cur;
- LYXERR(Debug::DEPEND) << itr->first << " same mtime" << endl;
+ LYXERR(Debug::DEPEND, itr->first << " same mtime");
} else {
di.crc_prev = di.crc_cur;
- LYXERR(Debug::DEPEND) << itr->first << " CRC... " << flush;
+ LYXERR(Debug::DEPEND, itr->first << " CRC... ");
di.crc_cur = sum(itr->first);
- LYXERR(Debug::DEPEND) << "done" << endl;
+ LYXERR(Debug::DEPEND, "done");
}
} else {
// file doesn't exist
// remove stale files - if it's re-created, it
// will be re-inserted by deplog.
- LYXERR(Debug::DEPEND) << itr->first
- << " doesn't exist. removing from DepTable." << endl;
+ LYXERR(Debug::DEPEND, itr->first
+ << " doesn't exist. removing from DepTable.");
DepList::iterator doomed = itr++;
deplist.erase(doomed);
continue;
++itr;
}
time_type const time_sec = current_time() - start_time;
- LYXERR(Debug::DEPEND) << "Finished updating DepTable ("
- << time_sec << " sec)." << endl;
+ LYXERR(Debug::DEPEND, "Finished updating DepTable ("
+ << time_sec << " sec).");
}
// Store the second (most recently calculated)
// CRC value.
// The older one is effectively set to 0 upon re-load.
- LYXERR(Debug::DEPEND) << "Write dep: "
+ LYXERR(Debug::DEPEND, "Write dep: "
<< cit->second.crc_cur << ' '
<< cit->second.mtime_cur << ' '
- << cit->first << endl;
+ << cit->first);
ofs << cit->second.crc_cur << ' '
<< cit->second.mtime_cur << ' '
while (ifs >> di.crc_cur >> di.mtime_cur && getline(ifs, nome)) {
nome = ltrim(nome);
- LYXERR(Debug::DEPEND) << "Read dep: "
- << di.crc_cur << ' ' << di.mtime_cur << ' ' << nome << endl;
+ LYXERR(Debug::DEPEND, "Read dep: "
+ << di.crc_cur << ' ' << di.mtime_cur << ' ' << nome);
deplist[FileName(nome)] = di;
}
if (&cs.inset() != inset) {
// the whole slice is wrong, chop off this as well
--i;
- LYXERR(Debug::DEBUG) << "fixIfBroken(): inset changed" << endl;
+ LYXERR(Debug::DEBUG, "fixIfBroken(): inset changed");
break;
} else if (cs.idx() > cs.lastidx()) {
cs.idx() = cs.lastidx();
cs.pit() = cs.lastpit();
cs.pos() = cs.lastpos();
- LYXERR(Debug::DEBUG) << "fixIfBroken(): idx fixed" << endl;
+ LYXERR(Debug::DEBUG, "fixIfBroken(): idx fixed");
break;
} else if (cs.pit() > cs.lastpit()) {
cs.pit() = cs.lastpit();
cs.pos() = cs.lastpos();
- LYXERR(Debug::DEBUG) << "fixIfBroken(): pit fixed" << endl;
+ LYXERR(Debug::DEBUG, "fixIfBroken(): pit fixed");
break;
} else if (cs.pos() > cs.lastpos()) {
cs.pos() = cs.lastpos();
- LYXERR(Debug::DEBUG) << "fixIfBroken(): pos fixed" << endl;
+ LYXERR(Debug::DEBUG, "fixIfBroken(): pos fixed");
break;
} else if (i != n - 1 && cs.pos() != cs.lastpos()) {
// get inset which is supposed to be in the next slice
// Did we make it through the whole slice stack? Otherwise there
// was a problem at slice i, and we have to chop off above
if (i < n) {
- LYXERR(Debug::DEBUG) << "fixIfBroken(): cursor chopped at " << i << endl;
+ LYXERR(Debug::DEBUG, "fixIfBroken(): cursor chopped at " << i);
resize(i + 1);
return true;
} else
bformat(_("Cannot copy file %1$s to %2$s.\n"
"Please check whether the directory exists and is writeable."),
from_utf8(emb_file), from_utf8(ext_file)));
- //LYXERR(Debug::DEBUG) << "Fs error: " << fe.what() << endl;
+ //LYXERR(Debug::DEBUG, "Fs error: " << fe.what());
return false;
}
bformat(_("Cannot copy file %1$s to %2$s.\n"
"Please check whether the directory exists and is writeable."),
from_utf8(ext_file), from_utf8(emb_file)));
- //LYXERR(Debug::DEBUG) << "Fs error: " << fe.what() << endl;
+ //LYXERR(Debug::DEBUG, "Fs error: " << fe.what());
return false;
}
bformat(_("Cannot create file %1$s.\n"
"Please check whether the directory exists and is writeable."),
from_utf8(filename.absFilename())));
- //LYXERR(Debug::DEBUG) << "Fs error: " << fe.what() << endl;
+ //LYXERR(Debug::DEBUG, "Fs error: " << fe.what());
}
return true;
}
if (!info.preamble.empty())
info.feature = info.preamble[0] != '\\';
- LYXERR(Debug::INFO)
- << "Read unicode symbol " << symbol << " '"
+ LYXERR(Debug::INFO, "Read unicode symbol " << symbol << " '"
<< to_utf8(info.command) << "' '" << info.preamble
- << "' " << info.combining << ' ' << info.feature
- << endl;
+ << "' " << info.combining << ' ' << info.feature);
unicodesymbols[symbol] = info;
}
"Unknown package: `$$Token'");
}
- LYXERR(Debug::INFO) << "Reading encoding " << name << endl;
+ LYXERR(Debug::INFO, "Reading encoding " << name);
encodinglist[name] = Encoding(name, latexname,
iconvname, fixedwidth,
package);
Language const * doc_language = bparams.language;
if (bits_.noun() == FONT_ON) {
- LYXERR(Debug::LATEX) << "font.noun: "
- << bits_.noun()
- << endl;
+ LYXERR(Debug::LATEX, "font.noun: " << bits_.noun());
features.require("noun");
- LYXERR(Debug::LATEX) << "Noun enabled. Font: "
- << to_utf8(stateText(0))
- << endl;
+ LYXERR(Debug::LATEX, "Noun enabled. Font: " << to_utf8(stateText(0)));
}
switch (bits_.color()) {
case Color_none:
break;
default:
features.require("color");
- LYXERR(Debug::LATEX) << "Color enabled. Font: "
- << to_utf8(stateText(0))
- << endl;
+ LYXERR(Debug::LATEX, "Color enabled. Font: " << to_utf8(stateText(0)));
}
// FIXME: Do something for background and soul package?
lang_ != latex_language)
{
features.useLanguage(lang_);
- LYXERR(Debug::LATEX) << "Found language "
- << lang_->lang() << endl;
+ LYXERR(Debug::LATEX, "Found language " << lang_->lang());
}
}
find_if(formatlist.begin(), formatlist.end(),
FormatExtensionsEqual(ext));
if (cit != formats.end()) {
- LYXERR(Debug::GRAPHICS)
- << "\twill guess format from file extension: "
- << ext << " -> " << cit->name() << std::endl;
+ LYXERR(Debug::GRAPHICS, "\twill guess format from file extension: "
+ << ext << " -> " << cit->name());
return cit->name();
}
}
command = subst(command, token_from_format, quoteName(filename.toFilesystemEncoding()));
command = subst(command, token_path_format, quoteName(onlyPath(filename.toFilesystemEncoding())));
command = subst(command, token_socket_format, quoteName(theServerSocket().address()));
- LYXERR(Debug::FILES) << "Executing command: " << command << std::endl;
+ LYXERR(Debug::FILES, "Executing command: " << command);
// FIXME UNICODE utf8 can be wrong for files
buffer.message(_("Executing command: ") + from_utf8(command));
command = subst(command, token_from_format, quoteName(filename.toFilesystemEncoding()));
command = subst(command, token_path_format, quoteName(onlyPath(filename.toFilesystemEncoding())));
command = subst(command, token_socket_format, quoteName(theServerSocket().address()));
- LYXERR(Debug::FILES) << "Executing command: " << command << std::endl;
+ LYXERR(Debug::FILES, "Executing command: " << command);
// FIXME UNICODE utf8 can be wrong for files
buffer.message(_("Executing command: ") + from_utf8(command));
ISpell::ISpell(BufferParams const & params, string const & lang)
: in(0), out(0), inerr(0), str(0)
{
- //LYXERR(Debug::GUI) << "Created ispell" << endl;
+ //LYXERR(Debug::GUI, "Created ispell");
encoding = params.encoding().iconvName();
ISpell::~ISpell()
{
- //LYXERR(Debug::GUI) << "Killing ispell" << endl;
+ //LYXERR(Debug::GUI, "Killing ispell");
if (in)
fclose(in);
void Intl::initKeyMapper(bool on)
{
- LYXERR(Debug::INIT) << "Initializing key mappings..." << endl;
+ LYXERR(Debug::INIT, "Initializing key mappings...");
if (trans.setPrimary(prim_lang) == -1)
prim_lang.erase();
size_t KeyMap::bind(string const & seq, FuncRequest const & func)
{
- LYXERR(Debug::KBMAP) << "BIND: Sequence `"
- << seq << "' Action `"
- << func.action << '\'' << endl;
+ LYXERR(Debug::KBMAP, "BIND: Sequence `" << seq << "' Action `"
+ << func.action << '\'');
KeySequence k(0, 0);
if (res == string::npos) {
bind(&k, func);
} else {
- LYXERR(Debug::KBMAP) << "Parse error at position " << res
- << " in key sequence '" << seq << "'."
- << endl;
+ LYXERR(Debug::KBMAP, "Parse error at position " << res
+ << " in key sequence '" << seq << "'.");
}
return res == string::npos ? 0 : res;
if (res == string::npos)
unbind(&k, func);
else
- LYXERR(Debug::KBMAP) << "Parse error at position " << res
- << " in key sequence '" << seq << "'."
- << endl;
+ LYXERR(Debug::KBMAP, "Parse error at position " << res
+ << " in key sequence '" << seq << "'.");
return res == string::npos ? 0 : res;
}
return false;
}
- LYXERR(Debug::KBMAP) << "Reading bind file:" << tmp << endl;
+ LYXERR(Debug::KBMAP, "Reading bind file:" << tmp);
bool error = false;
while (lexrc.isOK()) {
&& mod2 == it->mod.second) {
// overwrite binding
if (r + 1 == seq->length()) {
- LYXERR(Debug::KBMAP)
- << "Warning: New binding for '"
+ LYXERR(Debug::KBMAP, "Warning: New binding for '"
<< to_utf8(seq->print(KeySequence::Portable))
- << "' is overriding old binding..."
- << endl;
+ << "' is overriding old binding...");
if (it->table.get()) {
it->table.reset();
}
FileName const aux_file(changeExtension(file.absFilename(), "aux"));
if (had_depfile) {
- LYXERR(Debug::DEPEND) << "Dependency file exists" << endl;
+ LYXERR(Debug::DEPEND, "Dependency file exists");
// Read the dep file:
had_depfile = head.read(depfile);
}
// to re-run latex and collect the error messages
// (even if they are the same).
if (!output_file.exists()) {
- LYXERR(Debug::DEPEND)
- << "re-running LaTeX because output file doesn't exist."
- << endl;
+ LYXERR(Debug::DEPEND,
+ "re-running LaTeX because output file doesn't exist.");
} else if (!head.sumchange()) {
- LYXERR(Debug::DEPEND) << "return no_change" << endl;
+ LYXERR(Debug::DEPEND, "return no_change");
return NO_CHANGE;
} else {
- LYXERR(Debug::DEPEND)
- << "Dependency file has changed" << endl;
+ LYXERR(Debug::DEPEND, "Dependency file has changed");
}
if (head.extchanged(".bib") || head.extchanged(".bst"))
run_bibtex = true;
} else
- LYXERR(Debug::DEPEND)
- << "Dependency file does not exist, or has wrong format"
- << endl;
+ LYXERR(Debug::DEPEND,
+ "Dependency file does not exist, or has wrong format");
/// We scan the aux file even when had_depfile = false,
/// because we can run pdflatex on the file after running latex on it,
bibtex_info_old = scanAuxFiles(aux_file);
++count;
- LYXERR(Debug::LATEX) << "Run #" << count << endl;
+ LYXERR(Debug::LATEX, "Run #" << count);
message(runMessage(count));
startscript();
scanres = scanLogFile(terr);
if (scanres & ERROR_RERUN) {
- LYXERR(Debug::LATEX) << "Rerunning LaTeX" << endl;
+ LYXERR(Debug::LATEX, "Rerunning LaTeX");
startscript();
scanres = scanLogFile(terr);
}
// run makeindex
if (head.haschanged(idxfile)) {
// no checks for now
- LYXERR(Debug::LATEX) << "Running MakeIndex." << endl;
+ LYXERR(Debug::LATEX, "Running MakeIndex.");
message(_("Running MakeIndex."));
// onlyFilename() is needed for cygwin
rerun |= runMakeIndex(onlyFilename(idxfile.absFilename()),
// "\bibdata" and/or "\bibstyle". If one of those
// tags is found -> run bibtex and set rerun = true;
// no checks for now
- LYXERR(Debug::LATEX) << "Running BibTeX." << endl;
+ LYXERR(Debug::LATEX, "Running BibTeX.");
message(_("Running BibTeX."));
updateBibtexDependencies(head, bibtex_info);
rerun |= runBibTeX(bibtex_info);
if (rerun || head.sumchange()) {
rerun = false;
++count;
- LYXERR(Debug::DEPEND)
- << "Dep. file has changed or rerun requested"
- << endl;
- LYXERR(Debug::LATEX)
- << "Run #" << count << endl;
+ LYXERR(Debug::DEPEND, "Dep. file has changed or rerun requested");
+ LYXERR(Debug::LATEX, "Run #" << count);
message(runMessage(count));
startscript();
scanres = scanLogFile(terr);
deplog(head); // reads the latex log
head.update();
} else {
- LYXERR(Debug::DEPEND)
- << "Dep. file has NOT changed"
- << endl;
+ LYXERR(Debug::DEPEND, "Dep. file has NOT changed");
}
// 1.5
// run makeindex if the <file>.idx has changed or was generated.
if (head.haschanged(idxfile)) {
// no checks for now
- LYXERR(Debug::LATEX) << "Running MakeIndex." << endl;
+ LYXERR(Debug::LATEX, "Running MakeIndex.");
message(_("Running MakeIndex."));
// onlyFilename() is needed for cygwin
rerun = runMakeIndex(onlyFilename(changeExtension(
// MAX_RUNS are reached.
rerun = false;
++count;
- LYXERR(Debug::LATEX) << "Run #" << count << endl;
+ LYXERR(Debug::LATEX, "Run #" << count);
message(runMessage(count));
startscript();
scanres = scanLogFile(terr);
// Write the dependencies to file.
head.write(depfile);
- LYXERR(Debug::LATEX) << "Done." << endl;
+ LYXERR(Debug::LATEX, "Done.");
return scanres;
}
bool LaTeX::runMakeIndex(string const & f, OutputParams const & runparams,
string const & params)
{
- LYXERR(Debug::LATEX)
- << "idx file has been made, running makeindex on file "
- << f << endl;
+ LYXERR(Debug::LATEX,
+ "idx file has been made, running makeindex on file " << f);
string tmp = lyxrc.index_command + ' ';
tmp = subst(tmp, "$$lang", runparams.document_language);
OutputParams const & runparams,
string const & nlo, string const & nls)
{
- LYXERR(Debug::LATEX) << "Running MakeIndex for nomencl." << endl;
+ LYXERR(Debug::LATEX, "Running MakeIndex for nomencl.");
message(_("Running MakeIndex for nomencl."));
// onlyFilename() is needed for cygwin
string const nomenclstr = " -s nomencl.ist -o "
void LaTeX::scanAuxFile(FileName const & file, Aux_Info & aux_info)
{
- LYXERR(Debug::LATEX) << "Scanning aux file: " << file << endl;
+ LYXERR(Debug::LATEX, "Scanning aux file: " << file);
ifstream ifs(file.toFilesystemEncoding().c_str());
string token;
while (!data.empty()) {
string citation;
data = split(data, citation, ',');
- LYXERR(Debug::LATEX) << "Citation: "
- << citation << endl;
+ LYXERR(Debug::LATEX, "Citation: " << citation);
aux_info.citations.insert(citation);
}
} else if (regex_match(token, sub, reg2)) {
string database;
data = split(data, database, ',');
database = changeExtension(database, "bib");
- LYXERR(Debug::LATEX) << "BibTeX database: `"
- << database << '\'' << endl;
+ LYXERR(Debug::LATEX, "BibTeX database: `" << database << '\'');
aux_info.databases.insert(database);
}
} else if (regex_match(token, sub, reg3)) {
// token is now the style file
// pass it to the helper
style = changeExtension(style, "bst");
- LYXERR(Debug::LATEX) << "BibTeX style: `"
- << style << '\'' << endl;
+ LYXERR(Debug::LATEX, "BibTeX style: `" << style << '\'');
aux_info.styles.insert(style);
} else if (regex_match(token, sub, reg4)) {
string const file2 = sub.str(1);
int retval = NO_ERRORS;
string tmp =
onlyFilename(changeExtension(file.absFilename(), ".log"));
- LYXERR(Debug::LATEX) << "Log file: " << tmp << endl;
+ LYXERR(Debug::LATEX, "Log file: " << tmp);
FileName const fn = FileName(makeAbsPath(tmp));
ifstream ifs(fn.toFilesystemEncoding().c_str());
bool fle_style = false;
token = subst(token, "\r", "");
smatch sub;
- LYXERR(Debug::LATEX) << "Log line: " << token << endl;
+ LYXERR(Debug::LATEX, "Log line: " << token);
if (token.empty())
continue;
// Here shall we handle different
// types of warnings
retval |= LATEX_WARNING;
- LYXERR(Debug::LATEX) << "LaTeX Warning." << endl;
+ LYXERR(Debug::LATEX, "LaTeX Warning.");
if (contains(token, "Rerun to get cross-references")) {
retval |= RERUN;
- LYXERR(Debug::LATEX)
- << "We should rerun." << endl;
+ LYXERR(Debug::LATEX, "We should rerun.");
} else if (contains(token, "Citation")
&& contains(token, "on page")
&& contains(token, "undefined")) {
contains(token, "Rerun to get")) {
// at least longtable.sty and bibtopic.sty
// might use this.
- LYXERR(Debug::LATEX)
- << "We should rerun." << endl;
+ LYXERR(Debug::LATEX, "We should rerun.");
retval |= RERUN;
}
} else if (token[0] == '(') {
if (contains(token, "Rerun LaTeX") ||
contains(token, "Rerun to get")) {
// Used by natbib
- LYXERR(Debug::LATEX)
- << "We should rerun." << endl;
+ LYXERR(Debug::LATEX, "We should rerun.");
retval |= RERUN;
}
} else if (prefixIs(token, "! ") ||
errstr += "\n";
getline(ifs, tmp);
}
- LYXERR(Debug::LATEX)
- << "line: " << line << '\n'
- << "Desc: " << desc << '\n'
- << "Text: " << errstr << endl;
+ LYXERR(Debug::LATEX, "line: " << line << '\n'
+ << "Desc: " << desc << '\n' << "Text: " << errstr);
if (line == last_line)
++line_count;
else {
}
}
}
- LYXERR(Debug::LATEX) << "Log line: " << token << endl;
+ LYXERR(Debug::LATEX, "Log line: " << token);
return retval;
}
// convert from native os path to unix path
string foundfile = os::internal_path(trim(ff));
- LYXERR(Debug::DEPEND) << "Found file: " << foundfile << endl;
+ LYXERR(Debug::DEPEND, "Found file: " << foundfile);
// Ok now we found a file.
// Now we should make sure that this is a file that we can
// absolute path and should
// be inserted.
if (absolutePath(foundfile)) {
- LYXERR(Debug::DEPEND) << "AbsolutePath file: "
- << foundfile << endl;
+ LYXERR(Debug::DEPEND, "AbsolutePath file: " << foundfile);
// On initial insert we want to do the update at once
// since this file cannot be a file generated by
// the latex run.
// version of nomencl.sty. Do we need to put it back?
static regex const unwanted("^.*\\.(aux|log|dvi|bbl|ind)$");
if (regex_match(onlyfile, unwanted)) {
- LYXERR(Debug::DEPEND) << "We don't want " << onlyfile
- << " in the dep file" << endl;
+ LYXERR(Debug::DEPEND, "We don't want " << onlyfile
+ << " in the dep file");
} else if (suffixIs(onlyfile, ".tex")) {
// This is a tex file generated by LyX
// and latex is not likely to change this
// during its runs.
- LYXERR(Debug::DEPEND) << "Tmpdir TeX file: " << onlyfile << endl;
+ LYXERR(Debug::DEPEND, "Tmpdir TeX file: " << onlyfile);
head.insert(absname, true);
} else {
- LYXERR(Debug::DEPEND) << "In tmpdir file:" << onlyfile << endl;
+ LYXERR(Debug::DEPEND, "In tmpdir file:" << onlyfile);
head.insert(absname);
}
return true;
} else {
- LYXERR(Debug::DEPEND)
- << "Not a file or we are unable to find it." << endl;
+ LYXERR(Debug::DEPEND, "Not a file or we are unable to find it.");
return false;
}
}
bool checkLineBreak(string const & ff, DepTable & head)
{
- if (contains(ff, '.'))
- // if we have a dot, we let handleFoundFile decide
- return handleFoundFile(ff, head);
- else
- // else, we suspect a line break
+ if (!contains(ff, '.'))
return false;
+
+ // if we have a dot, we let handleFoundFile decide
+ return handleFoundFile(ff, head);
}
} // anon namespace
lang = lex.getString();
else
break;
- LYXERR(Debug::INFO) << "Reading language " << lang << endl;
+ LYXERR(Debug::INFO, "Reading language " << lang);
if (lex.next())
babel = lex.getString();
string const format = filename.guessFormatFromContents();
if (format == "gzip" || format == "zip" || format == "compress") {
- LYXERR(Debug::LYXLEX) << "lyxlex: compressed" << endl;
+ LYXERR(Debug::LYXLEX, "lyxlex: compressed");
// The check only outputs a debug message, because it triggers
// a bug in compaq cxx 6.2, where is_open() returns 'true' for
// a fresh new filebuf. (JMarc)
lineno = 0;
return gz_.is_open() && is.good();
} else {
- LYXERR(Debug::LYXLEX) << "lyxlex: UNcompressed" << endl;
+ LYXERR(Debug::LYXLEX, "lyxlex: UNcompressed");
// The check only outputs a debug message, because it triggers
// a bug in compaq cxx 6.2, where is_open() returns 'true' for
// a fresh new filebuf. (JMarc)
if (fb_.is_open() || istream::off_type(is.tellg()) > 0) {
- LYXERR(Debug::LYXLEX) << "Error in Lexer::setFile: "
- "file or stream already set." << endl;
+ LYXERR(Debug::LYXLEX, "Error in Lexer::setFile: "
+ "file or stream already set.");
}
fb_.open(filename.toFilesystemEncoding().c_str(), ios::in);
is.rdbuf(&fb_);
void Lexer::Pimpl::setStream(istream & i)
{
if (fb_.is_open() || istream::off_type(is.tellg()) > 0) {
- LYXERR(Debug::LYXLEX) << "Error in Lexer::setStream: "
- "file or stream already set." << endl;
+ LYXERR(Debug::LYXLEX, "Error in Lexer::setStream: "
+ "file or stream already set.");
}
is.rdbuf(i.rdbuf());
lineno = 0;
string dummy;
getline(is, dummy);
- LYXERR(Debug::LYXLEX) << "Comment read: `" << c
- << dummy << '\'' << endl;
+ LYXERR(Debug::LYXLEX, "Comment read: `" << c << dummy << '\'');
#else
// unfortunately ignore is buggy (Lgb)
is.ignore(100, '\n');
string dummy;
getline(is, dummy);
- LYXERR(Debug::LYXLEX) << "Comment read: `" << c
- << dummy << '\'' << endl;
+ LYXERR(Debug::LYXLEX, "Comment read: `" << c << dummy << '\'');
#else
// but ignore is also still buggy (Lgb)
// This is fast (Lgb)
while (is && c != '\n') {
is.get(cc);
c = cc;
- //LYXERR(Debug::LYXLEX) << "Lexer::EatLine read char: `"
- // << c << '\'' << endl;
+ //LYXERR(Debug::LYXLEX, "Lexer::EatLine read char: `" << c << '\'');
if (c != '\r')
buff.push_back(c);
}
string const token = trim(getString(), " \t");
- LYXERR(Debug::PARSER) << "LongString: `"
- << getString() << '\'' << endl;
+ LYXERR(Debug::PARSER, "LongString: `" << getString() << '\'');
// We do a case independent comparison, like search_kw does.
if (compare_ascii_no_case(token, endtoken) == 0)
if (i != string::npos)
prefix = tmpstr.substr(0, i);
firstline = false;
- LYXERR(Debug::PARSER)
- << "Prefix = `" << prefix << "\'" << endl;
+ LYXERR(Debug::PARSER, "Prefix = `" << prefix << "\'");
}
// further lines in long strings may have the same
// do any other cleanup procedures now
if (package().temp_dir() != package().system_temp_dir()) {
- LYXERR(Debug::INFO) << "Deleting tmp dir "
- << package().temp_dir().absFilename() << endl;
+ LYXERR(Debug::INFO, "Deleting tmp dir "
+ << package().temp_dir().absFilename());
if (!package().temp_dir().destroyDirectory()) {
docstring const msg =
}
// Initialization of LyX (reads lyxrc and more)
- LYXERR(Debug::INIT) << "Initializing LyX::init..." << endl;
+ LYXERR(Debug::INIT, "Initializing LyX::init...");
bool success = init();
- LYXERR(Debug::INIT) << "Initializing LyX::init...done" << endl;
+ LYXERR(Debug::INIT, "Initializing LyX::init...done");
if (!success)
return EXIT_FAILURE;
if (pimpl_->batch_command.empty())
return;
- LYXERR(Debug::INIT) << "About to handle -x '"
- << pimpl_->batch_command << '\'' << endl;
+ LYXERR(Debug::INIT, "About to handle -x '" << pimpl_->batch_command << '\'');
pimpl_->lyxfunc_.dispatch(lyxaction.lookupFunc(pimpl_->batch_command));
}
return false;
// Load the layouts
- LYXERR(Debug::INIT) << "Reading layouts..." << endl;
+ LYXERR(Debug::INIT, "Reading layouts...");
if (!LyXSetStyle())
return false;
//...and the modules
return false;
}
- LYXERR(Debug::INIT) << "LyX tmp dir: `"
- << package().temp_dir().absFilename()
- << '\'' << endl;
+ LYXERR(Debug::INIT, "LyX tmp dir: `"
+ << package().temp_dir().absFilename() << '\'');
- LYXERR(Debug::INIT) << "Reading session information '.lyx/session'..." << endl;
+ LYXERR(Debug::INIT, "Reading session information '.lyx/session'...");
pimpl_->session_.reset(new Session(lyxrc.num_lastfiles));
// This must happen after package initialization and after lyxrc is
bool LyX::readRcFile(string const & name)
{
- LYXERR(Debug::INIT) << "About to read " << name << "... ";
+ LYXERR(Debug::INIT, "About to read " << name << "... ");
FileName const lyxrc_path = libFileSearch(string(), name);
if (!lyxrc_path.empty()) {
-
- LYXERR(Debug::INIT) << "Found in " << lyxrc_path << endl;
-
+ LYXERR(Debug::INIT, "Found in " << lyxrc_path);
if (lyxrc.read(lyxrc_path) < 0) {
showFileError(name);
return false;
}
- } else
- LYXERR(Debug::INIT) << "Not found." << lyxrc_path << endl;
+ } else {
+ LYXERR(Debug::INIT, "Not found." << lyxrc_path);
+ }
return true;
-
}
std::list<string>::const_iterator end = uifiles.end();
it = std::find(it, end, name);
if (it != end) {
- LYXERR(Debug::INIT) << "UI file '" << name
- << "' has been read already. "
- << "Is this an include loop?"
- << endl;
+ LYXERR(Debug::INIT, "UI file '" << name << "' has been read already. "
+ << "Is this an include loop?");
return false;
}
- LYXERR(Debug::INIT) << "About to read " << name << "..." << endl;
+ LYXERR(Debug::INIT, "About to read " << name << "...");
FileName ui_path;
ui_path = libFileSearch("ui", name, "ui");
if (ui_path.empty()) {
- LYXERR(Debug::INIT) << "Could not find " << name << endl;
+ LYXERR(Debug::INIT, "Could not find " << name);
showFileError(name);
return false;
}
uifiles.push_back(name);
- LYXERR(Debug::INIT) << "Found " << name
- << " in " << ui_path << endl;
+ LYXERR(Debug::INIT, "Found " << name << " in " << ui_path);
Lexer lex(uitags, ui_last - 1);
lex.setFile(ui_path);
if (!lex.isOK()) {
// Read the languages file `name'
bool LyX::readLanguagesFile(string const & name)
{
- LYXERR(Debug::INIT) << "About to read " << name << "..." << endl;
+ LYXERR(Debug::INIT, "About to read " << name << "...");
FileName const lang_path = libFileSearch(string(), name);
if (lang_path.empty()) {
bool LyX::readEncodingsFile(string const & enc_name,
string const & symbols_name)
{
- LYXERR(Debug::INIT) << "About to read " << enc_name << " and "
- << symbols_name << "..." << endl;
+ LYXERR(Debug::INIT, "About to read " << enc_name << " and "
+ << symbols_name << "...");
FileName const symbols_path = libFileSearch(string(), symbols_name);
if (symbols_path.empty()) {
void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
{
- LYXERR(Debug::KEY) << "KeySym is " << keysym.getSymbolName() << endl;
+ LYXERR(Debug::KEY, "KeySym is " << keysym.getSymbolName());
// Do nothing if we have nothing (JMarc)
if (!keysym.isOK()) {
- LYXERR(Debug::KEY) << "Empty kbd action (probably composing)"
- << endl;
+ LYXERR(Debug::KEY, "Empty kbd action (probably composing)");
lyx_view_->restartCursor();
return;
}
if (keysym.isModifier()) {
- LYXERR(Debug::KEY) << "isModifier true" << endl;
+ LYXERR(Debug::KEY, "isModifier true");
lyx_view_->restartCursor();
return;
}
cancel_meta_seq.reset();
FuncRequest func = cancel_meta_seq.addkey(keysym, state);
- LYXERR(Debug::KEY) << BOOST_CURRENT_FUNCTION
- << " action first set to [" << func.action << ']'
- << endl;
+ LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
+ << " action first set to [" << func.action << ']');
// When not cancel or meta-fake, do the normal lookup.
// Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
if ((func.action != LFUN_CANCEL) && (func.action != LFUN_META_PREFIX)) {
// remove Caps Lock and Mod2 as a modifiers
func = keyseq.addkey(keysym, (state | meta_fake_bit));
- LYXERR(Debug::KEY) << BOOST_CURRENT_FUNCTION
- << "action now set to ["
- << func.action << ']' << endl;
+ LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
+ << "action now set to [" << func.action << ']');
}
// Dont remove this unless you know what you are doing.
if (func.action == LFUN_NOACTION)
func = FuncRequest(LFUN_COMMAND_PREFIX);
- LYXERR(Debug::KEY) << BOOST_CURRENT_FUNCTION
- << " Key [action="
- << func.action << "]["
- << to_utf8(keyseq.print(KeySequence::Portable)) << ']'
- << endl;
+ LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
+ << " Key [action=" << func.action << "]["
+ << to_utf8(keyseq.print(KeySequence::Portable)) << ']');
// already here we know if it any point in going further
// why not return already here if action == -1 and
// Maybe user can only reach the key via holding down shift.
// Let's see. But only if shift is the only modifier
if (func.action == LFUN_UNKNOWN_ACTION && state == ShiftModifier) {
- LYXERR(Debug::KEY) << "Trying without shift" << endl;
+ LYXERR(Debug::KEY, "Trying without shift");
func = keyseq.addkey(keysym, NoModifier);
- LYXERR(Debug::KEY) << "Action now " << func.action << endl;
+ LYXERR(Debug::KEY, "Action now " << func.action);
}
if (func.action == LFUN_UNKNOWN_ACTION) {
// if it's normal insertable text not already covered
// by a binding
if (keysym.isText() && keyseq.length() == 1) {
- LYXERR(Debug::KEY) << "isText() is true, inserting." << endl;
+ LYXERR(Debug::KEY, "isText() is true, inserting.");
func = FuncRequest(LFUN_SELF_INSERT,
FuncRequest::KEYBOARD);
} else {
- LYXERR(Debug::KEY) << "Unknown, !isText() - giving up" << endl;
+ LYXERR(Debug::KEY, "Unknown, !isText() - giving up");
lyx_view_->message(_("Unknown function."));
lyx_view_->restartCursor();
return;
docstring const arg(1, encoded_last_key);
dispatch(FuncRequest(LFUN_SELF_INSERT, arg,
FuncRequest::KEYBOARD));
- LYXERR(Debug::KEY)
- << "SelfInsert arg[`" << to_utf8(arg) << "']" << endl;
+ LYXERR(Debug::KEY, "SelfInsert arg[`" << to_utf8(arg) << "']");
}
} else {
dispatch(func);
string const argument = to_utf8(cmd.argument());
kb_action const action = cmd.action;
- LYXERR(Debug::ACTION) << endl << "LyXFunc::dispatch: cmd: " << cmd << endl;
+ LYXERR(Debug::ACTION, "\nLyXFunc::dispatch: cmd: " << cmd);
//lyxerr << "LyXFunc::dispatch: cmd: " << cmd << endl;
// we have not done anything wrong yet.
FuncStatus const flag = getStatus(cmd);
if (!flag.enabled()) {
// We cannot use this function here
- LYXERR(Debug::ACTION) << "LyXFunc::dispatch: "
+ LYXERR(Debug::ACTION, "LyXFunc::dispatch: "
<< lyxaction.getActionName(action)
- << " [" << action << "] is disabled at this location"
- << endl;
+ << " [" << action << "] is disabled at this location");
setErrorMessage(flag.message());
} else {
switch (action) {
case LFUN_SERVER_GET_NAME:
BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
setMessage(from_utf8(lyx_view_->buffer()->absFileName()));
- LYXERR(Debug::INFO) << "FNAME["
- << lyx_view_->buffer()->absFileName()
- << "] " << endl;
+ LYXERR(Debug::INFO, "FNAME["
+ << lyx_view_->buffer()->absFileName() << ']');
break;
case LFUN_SERVER_NOTIFY:
|| cmd.origin == FuncRequest::COMMANDBUFFER);
if (cmd.action == LFUN_SELF_INSERT || !verbose) {
- LYXERR(Debug::ACTION) << "dispatch msg is " << to_utf8(msg) << endl;
+ LYXERR(Debug::ACTION, "dispatch msg is " << to_utf8(msg));
if (!msg.empty())
lyx_view_->message(msg);
return;
dispatch_msg += '(' + rtrim(comname) + ')';
}
- LYXERR(Debug::ACTION) << "verbose dispatch msg "
- << to_utf8(dispatch_msg) << endl;
+ LYXERR(Debug::ACTION, "verbose dispatch msg " << to_utf8(dispatch_msg));
if (!dispatch_msg.empty())
lyx_view_->message(dispatch_msg);
}
string format;
string filename = split(argument, format, ' ');
- LYXERR(Debug::INFO) << "LyXFunc::doImport: " << format
- << " file: " << filename << endl;
+ LYXERR(Debug::INFO, "LyXFunc::doImport: " << format
+ << " file: " << filename);
// need user interaction
if (filename.empty()) {
lexrc.setFile(filename);
if (!lexrc.isOK()) return -2;
- LYXERR(Debug::LYXRC) << "Reading '" << filename << "'..." << endl;
+ LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
return read(lexrc);
}
lexrc.setStream(is);
if (!lexrc.isOK()) return -2;
- LYXERR(Debug::LYXRC) << "Reading istream..." << endl;
+ LYXERR(Debug::LYXRC, "Reading istream...");
return read(lexrc);
}
FileName const cvs_entries(makeAbsPath("CVS/Entries"));
if (cvs_entries.isFileReadable()) {
- LYXERR(Debug::LYXVC)
- << "LyXVC: registering "
- << to_utf8(filename.displayName())
- << " with CVS" << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: registering "
+ << to_utf8(filename.displayName()) << " with CVS");
vcs.reset(new CVS(cvs_entries, filename));
} else {
- LYXERR(Debug::LYXVC)
- << "LyXVC: registering "
- << to_utf8(filename.displayName())
- << " with RCS" << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: registering "
+ << to_utf8(filename.displayName()) << " with RCS");
vcs.reset(new RCS(filename));
}
vcs->owner(owner_);
}
- LYXERR(Debug::LYXVC) << "LyXVC: registrer" << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: registrer");
docstring response;
bool ok = Alert::askForText(response, _("LyX VC: Initial description"),
_("(no initial description)"));
if (!ok || response.empty()) {
// should we insist on checking response.empty()?
- LYXERR(Debug::LYXVC) << "LyXVC: user cancelled" << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: user cancelled");
return;
}
void LyXVC::checkIn()
{
-
- LYXERR(Debug::LYXVC) << "LyXVC: checkIn" << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: checkIn");
docstring response;
bool ok = Alert::askForText(response, _("LyX VC: Log Message"));
if (ok) {
response = _("(no log message)");
vcs->checkIn(to_utf8(response));
} else {
- LYXERR(Debug::LYXVC) << "LyXVC: user cancelled" << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: user cancelled");
}
}
void LyXVC::checkOut()
{
- LYXERR(Debug::LYXVC) << "LyXVC: checkOut" << endl;
-
+ LYXERR(Debug::LYXVC, "LyXVC: checkOut");
vcs->checkOut();
}
void LyXVC::revert()
{
- LYXERR(Debug::LYXVC) << "LyXVC: revert" << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: revert");
docstring const file = owner_->fileName().displayName(20);
docstring text = bformat(_("Reverting to the stored version of the "
{
switch (vcs->status()) {
case VCS::UNLOCKED:
- LYXERR(Debug::LYXVC) << "LyXVC: toggle to locked" << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: toggle to locked");
checkOut();
break;
case VCS::LOCKED:
- LYXERR(Debug::LYXVC) << "LyXVC: toggle to unlocked" << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: toggle to unlocked");
checkIn();
break;
}
FileName const tmpf(tempName(FileName(), "lyxvclog"));
if (tmpf.empty()) {
- LYXERR(Debug::LYXVC) << "Could not generate logfile "
- << tmpf << endl;
+ LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
return string();
}
- LYXERR(Debug::LYXVC) << "Generating logfile " << tmpf << endl;
+ LYXERR(Debug::LYXVC, "Generating logfile " << tmpf);
vcs->getLog(tmpf);
return tmpf.absFilename();
}
if (bindings.size())
return bindings.begin()->print(KeySequence::ForGui);
- LYXERR(Debug::KBMAP)
- << "No binding for "
+ LYXERR(Debug::KBMAP, "No binding for "
<< lyxaction.getActionName(func_.action)
- << '(' << to_utf8(func_.argument()) << ')' << endl;
+ << '(' << to_utf8(func_.argument()) << ')');
return docstring();
}
// strip off any encoding suffix, i.e., assume 8-bit po files
string::size_type i = lang_.find(".");
lang_ = lang_.substr(0, i);
- LYXERR(Debug::DEBUG) << BOOST_CURRENT_FUNCTION
- << ": language(" << lang_ << ")" << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << ": language(" << lang_ << ")");
}
char const * c = bindtextdomain(PACKAGE, locale_dir.c_str());
int e = errno;
if (e) {
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION << '\n'
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n'
<< "Error code: " << errno << '\n'
<< "Directory : " << package().locale_dir().absFilename() << '\n'
- << "Rtn value : " << c << endl;
+ << "Rtn value : " << c);
}
if (!bind_textdomain_codeset(PACKAGE, ucs4_codeset)) {
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION << '\n'
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n'
<< "Error code: " << errno << '\n'
- << "Codeset : " << ucs4_codeset << '\n'
- << endl;
+ << "Codeset : " << ucs4_codeset << '\n');
}
textdomain(PACKAGE);
else
translated = from_ascii(tmp);
} else {
- LYXERR(Debug::DEBUG) << "We got a translation" << endl;
+ LYXERR(Debug::DEBUG, "We got a translation");
// m is actually not a char const * but ucs4 data
translated = reinterpret_cast<char_type const *>(msg);
}
bool ModuleList::load()
{
support::FileName const real_file = libFileSearch("", "lyxmodules.lst");
- LYXERR(Debug::TCLASS) << "Reading modules from `"
- << real_file << '\'' << endl;
+ LYXERR(Debug::TCLASS, "Reading modules from `" << real_file << '\'');
if (real_file.empty()) {
lyxerr << "ModuleList::load(): unable to find "
bool finished = false;
// Parse modules files
- LYXERR(Debug::TCLASS) << "Starting parsing of lyxmodules.lst" << endl;
+ LYXERR(Debug::TCLASS, "Starting parsing of lyxmodules.lst");
while (lex.isOK() && !finished) {
- LYXERR(Debug::TCLASS) << "\tline by line" << endl;
+ LYXERR(Debug::TCLASS, "\tline by line");
switch (lex.lex()) {
case Lexer::LEX_FEOF:
finished = true;
break;
default:
string const modName = lex.getString();
- LYXERR(Debug::TCLASS) << "Module name: " << modName << endl;
+ LYXERR(Debug::TCLASS, "Module name: " << modName);
if (!lex.next())
break;
string const fname = lex.getString();
- LYXERR(Debug::TCLASS) << "Filename: " << fname << endl;
+ LYXERR(Debug::TCLASS, "Filename: " << fname);
if (!lex.next())
break;
string const desc = lex.getString();
- LYXERR(Debug::TCLASS) << "Description: " << desc << endl;
+ LYXERR(Debug::TCLASS, "Description: " << desc);
//FIXME Add packages
if (!lex.next())
break;
string packages = lex.getString();
- LYXERR(Debug::TCLASS) << "Packages: " << packages << endl;
+ LYXERR(Debug::TCLASS, "Packages: " << packages);
vector<string> pkgs;
while (!packages.empty()) {
string p;
} // end switch
} //end while
- LYXERR(Debug::TCLASS) << "End of parsing of lyxmodules.lst" << endl;
+ LYXERR(Debug::TCLASS, "End of parsing of lyxmodules.lst");
if (!moduleList.empty())
std::sort(moduleList.begin(), moduleList.end(), ModuleSorter());
: els(0), spell_error_object(0)
{
addManager(lang);
- LYXERR(Debug::GUI) << "created pspell" << endl;
+ LYXERR(Debug::GUI, "created pspell");
}
PSpell::~PSpell()
{
- LYXERR(Debug::GUI) << "killed pspell" << endl;
+ LYXERR(Debug::GUI, "killed pspell");
if (spell_error_object) {
delete_pspell_can_have_error(spell_error_object);
odocstream & os, TexRow & texrow,
OutputParams const & runparams) const
{
- LYXERR(Debug::LATEX) << "SimpleTeXOnePar... " << this << endl;
+ LYXERR(Debug::LATEX, "SimpleTeXOnePar... " << this);
bool return_value = false;
runparams.moving_arg);
}
- LYXERR(Debug::LATEX) << "SimpleTeXOnePar...done " << this << endl;
+ LYXERR(Debug::LATEX, "SimpleTeXOnePar...done " << this);
return return_value;
}
void LyXComm::openConnection()
{
- LYXERR(Debug::LYXSERVER) << "LyXComm: Opening connection" << endl;
+ LYXERR(Debug::LYXSERVER, "LyXComm: Opening connection");
// If we are up, that's an error
if (ready_) {
ready_ = false;
if (pipename_.empty()) {
- LYXERR(Debug::LYXSERVER)
- << "LyXComm: server is disabled, nothing to do"
- << endl;
+ LYXERR(Debug::LYXSERVER, "LyXComm: server is disabled, nothing to do");
return;
}
// We made it!
ready_ = true;
- LYXERR(Debug::LYXSERVER) << "LyXComm: Connection established" << endl;
+ LYXERR(Debug::LYXSERVER, "LyXComm: Connection established");
}
/// Close pipes
void LyXComm::closeConnection()
{
- LYXERR(Debug::LYXSERVER) << "LyXComm: Closing connection" << endl;
+ LYXERR(Debug::LYXSERVER, "LyXComm: Closing connection");
if (pipename_.empty()) {
- LYXERR(Debug::LYXSERVER)
- << "LyXComm: server is disabled, nothing to do"
- << endl;
+ LYXERR(Debug::LYXSERVER, "LyXComm: server is disabled, nothing to do");
return;
}
// the delim /wasn't/ found. ?:-P
string cmd;
read_buffer_= split(read_buffer_, cmd,'\n');
- LYXERR(Debug::LYXSERVER)
- << "LyXComm: status:" << status
+ LYXERR(Debug::LYXSERVER, "LyXComm: status:" << status
<< ", read_buffer_:" << read_buffer_
- << ", cmd:" << cmd << endl;
+ << ", cmd:" << cmd);
if (!cmd.empty())
clientcb_(client_, cmd);
//\n or not \n?
return;
}
- LYXERR(Debug::LYXSERVER) << "LyXComm: Sending '" << msg << '\'' << endl;
+ LYXERR(Debug::LYXSERVER, "LyXComm: Sending '" << msg << '\'');
if (pipename_.empty()) return;
// Handle data gotten from communication, called by LyXComm
void Server::callback(string const & msg)
{
- LYXERR(Debug::LYXSERVER) << "Server: Received: '"
- << msg << '\'' << endl;
+ LYXERR(Debug::LYXSERVER, "Server: Received: '" << msg << '\'');
char const * p = msg.c_str();
if (*p) ++p;
}
- LYXERR(Debug::LYXSERVER)
- << "Server: Client: '" << client
- << "' Command: '" << cmd
- << "' Argument: '" << arg << '\'' << endl;
+ LYXERR(Debug::LYXSERVER, "Server: Client: '" << client
+ << "' Command: '" << cmd << "' Argument: '" << arg << '\'');
// --- lookup and exec the command ------------------
if (cmd == "hello") {
// One more client
if (numclients_ == MAX_CLIENTS) { //paranoid check
- LYXERR(Debug::LYXSERVER)
- << "Server: too many clients..."
- << endl;
+ LYXERR(Debug::LYXSERVER, "Server: too many clients...");
return;
}
int i = 0;
clients_[i] = client;
++numclients_;
buf = "LYXSRV:" + client + ":hello\n";
- LYXERR(Debug::LYXSERVER)
- << "Server: Greeting "
- << client << endl;
+ LYXERR(Debug::LYXSERVER, "Server: Greeting " << client);
pipes_.send(buf);
} else if (cmd == "bye") {
// If clients_ == 0 maybe we should reset the pipes
if (i < numclients_) {
--numclients_;
clients_[i].erase();
- LYXERR(Debug::LYXSERVER)
- << "Server: Client "
- << client << " said goodbye"
- << endl;
+ LYXERR(Debug::LYXSERVER, "Server: Client "
+ << client << " said goodbye");
} else {
- LYXERR(Debug::LYXSERVER)
- << "Server: ignoring bye messge from unregistered client"
- << client << endl;
+ LYXERR(Debug::LYXSERVER,
+ "Server: ignoring bye messge from unregistered client" << client);
}
} else {
lyxerr <<"Server: Undefined server command "
boost::bind(&ServerSocket::serverCallback, this)
);
- LYXERR(Debug::LYXSERVER) << "lyx: New server socket "
- << fd_ << ' ' << address_.absFilename() << endl;
+ LYXERR(Debug::LYXSERVER, "lyx: New server socket "
+ << fd_ << ' ' << address_.absFilename());
}
<< " IO error on closing: " << strerror(errno);
}
support::unlink(address_);
- LYXERR(Debug::LYXSERVER) << "lyx: Server socket quitting" << endl;
+ LYXERR(Debug::LYXSERVER, "lyx: Server socket quitting");
}
int const client_fd = support::socktools::accept(fd_);
if (fd_ == -1) {
- LYXERR(Debug::LYXSERVER) << "lyx: Failed to accept new client"
- << endl;
+ LYXERR(Debug::LYXSERVER, "lyx: Failed to accept new client");
return;
}
LyXDataSocket::LyXDataSocket(int fd)
: fd_(fd), connected_(true)
{
- LYXERR(Debug::LYXSERVER) << "lyx: New data socket " << fd_ << endl;
+ LYXERR(Debug::LYXSERVER, "lyx: New data socket " << fd_);
}
<< " IO error on closing: " << strerror(errno);
theApp()->unregisterSocketCallback(fd_);
- LYXERR(Debug::LYXSERVER) << "lyx: Data socket " << fd_ << " quitting."
- << endl;
+ LYXERR(Debug::LYXSERVER, "lyx: Data socket " << fd_ << " quitting.");
}
// Error conditions. The buffer must still be
// processed for lines read
if (count == 0) { // EOF -- connection closed
- LYXERR(Debug::LYXSERVER) << "lyx: Data socket " << fd_
- << ": connection closed." << endl;
+ LYXERR(Debug::LYXSERVER, "lyx: Data socket " << fd_
+ << ": connection closed.");
connected_ = false;
} else if ((count == -1) && (errno != EAGAIN)) { // IO error
lyxerr << "lyx: Data socket " << fd_
// Cut a line from buffer
string::size_type pos = buffer_.find('\n');
if (pos == string::npos) {
- LYXERR(Debug::LYXSERVER) << "lyx: Data socket " << fd_
- << ": line not completed." << endl;
+ LYXERR(Debug::LYXSERVER, "lyx: Data socket " << fd_
+ << ": line not completed.");
return false; // No complete line stored
}
line = buffer_.substr(0, pos);
&& lastfiles.size() < num_lastfiles)
lastfiles.push_back(file);
else
- LYXERR(Debug::INIT) << "LyX: Warning: Ignore last file: " << tmp << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: Ignore last file: " << tmp);
} while (is.good());
}
if (0 < no && no <= absolute_max_last_files)
num_lastfiles = no;
else {
- LYXERR(Debug::INIT) << "LyX: session: too many last files\n"
- << "\tdefault (=" << default_num_last_files
- << ") used." << endl;
+ LYXERR(Debug::INIT, "LyX: session: too many last files\n"
+ << "\tdefault (=" << default_num_last_files << ") used.");
num_lastfiles = default_num_last_files;
}
}
if (file.exists() && !file.isDirectory())
lastopened.push_back(file);
else
- LYXERR(Debug::INIT) << "LyX: Warning: Ignore last opened file: " << tmp << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: Ignore last opened file: " << tmp);
} while (is.good());
}
&& lastfilepos.size() < num_lastfilepos)
lastfilepos[file] = filepos;
else
- LYXERR(Debug::INIT) << "LyX: Warning: Ignore pos of last file: " << fname << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: Ignore pos of last file: " << fname);
} catch (...) {
- LYXERR(Debug::INIT) << "LyX: Warning: unknown pos of last file: " << tmp << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: unknown pos of last file: " << tmp);
}
} while (is.good());
}
if (file.exists() && !file.isDirectory() && idx <= max_bookmarks)
bookmarks[idx] = Bookmark(file, pit, pos, 0, 0);
else
- LYXERR(Debug::INIT) << "LyX: Warning: Ignore bookmark of file: " << fname << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: Ignore bookmark of file: " << fname);
} catch (...) {
- LYXERR(Debug::INIT) << "LyX: Warning: unknown Bookmark info: " << tmp << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: unknown Bookmark info: " << tmp);
}
} while (is.good());
}
item.info.location = ToolbarInfo::Location(location);
toolbars.push_back(item);
} else
- LYXERR(Debug::INIT) << "LyX: Warning: Ignore toolbar info: " << tmp << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: Ignore toolbar info: " << tmp);
} catch (...) {
- LYXERR(Debug::INIT) << "LyX: Warning: unknown Toolbar info: " << tmp << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: unknown Toolbar info: " << tmp);
}
} while (is.good());
// sort the toolbars by location, line and position
string value = tmp.substr(pos + 3);
sessioninfo[key] = value;
} else
- LYXERR(Debug::INIT) << "LyX: Warning: Ignore session info: " << tmp << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: Ignore session info: " << tmp);
} catch (...) {
- LYXERR(Debug::INIT) << "LyX: Warning: unknown Session info: " << tmp << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: unknown Session info: " << tmp);
}
} while (is.good());
}
else if (tmp == sec_session)
sessionInfo().read(is);
else
- LYXERR(Debug::INIT) << "LyX: Warning: unknown Session section: " << tmp << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: unknown Session section: " << tmp);
}
}
toolbars().write(os);
sessionInfo().write(os);
} else
- LYXERR(Debug::INIT) << "LyX: Warning: unable to save Session: "
- << session_file << endl;
+ LYXERR(Debug::INIT, "LyX: Warning: unable to save Session: "
+ << session_file);
}
}
break;
}
- LYXERR(Debug::PARSER) << "Handling paragraph token: `"
- << token << '\'' << endl;
+ LYXERR(Debug::PARSER, "Handling paragraph token: `" << token << '\'');
if (token == "\\begin_layout" || token == "\\end_document"
|| token == "\\end_inset" || token == "\\begin_deeper"
|| token == "\\end_deeper") {
LayoutPtr const & lyxlayout = params.getTextClass()[layout];
if (lyxlayout->is_environment) {
// move everything in a new environment inset
- LYXERR(Debug::DEBUG) << "setting layout " << to_utf8(layout) << endl;
+ LYXERR(Debug::DEBUG, "setting layout " << to_utf8(layout));
lyx::dispatch(FuncRequest(LFUN_LINE_BEGIN));
lyx::dispatch(FuncRequest(LFUN_LINE_END_SELECT));
lyx::dispatch(FuncRequest(LFUN_CUT));
bool Text::deleteEmptyParagraphMechanism(Cursor & cur,
Cursor & old, bool & need_anchor_change)
{
- //LYXERR(Debug::DEBUG) << "DEPM: cur:\n" << cur << "old:\n" << old << endl;
+ //LYXERR(Debug::DEBUG, "DEPM: cur:\n" << cur << "old:\n" << old);
Paragraph & oldpar = old.paragraph();
void Text::dispatch(Cursor & cur, FuncRequest & cmd)
{
- LYXERR(Debug::ACTION) << "Text::dispatch: cmd: " << cmd << endl;
+ LYXERR(Debug::ACTION, "Text::dispatch: cmd: " << cmd);
// FIXME: We use the update flag to indicates wether a singlePar or a
// full screen update is needed. We reset it here but shall we restore it
case LFUN_LAYOUT: {
docstring layout = cmd.argument();
- LYXERR(Debug::INFO) << "LFUN_LAYOUT: (arg) " << to_utf8(layout) << endl;
+ LYXERR(Debug::INFO, "LFUN_LAYOUT: (arg) " << to_utf8(layout));
docstring const old_layout = cur.paragraph().layout()->name();
}
case LFUN_FINISHED_LEFT:
- LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_LEFT:\n" << cur << endl;
+ LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_LEFT:\n" << cur);
if (reverseDirectionNeeded(cur)) {
++cur.pos();
cur.setCurrentFont();
break;
case LFUN_FINISHED_RIGHT:
- LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_RIGHT:\n" << cur << endl;
+ LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_RIGHT:\n" << cur);
if (!reverseDirectionNeeded(cur)) {
++cur.pos();
cur.setCurrentFont();
break;
case LFUN_FINISHED_BACKWARD:
- LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_BACKWARD:\n" << cur << endl;
+ LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_BACKWARD:\n" << cur);
break;
case LFUN_FINISHED_FORWARD:
- LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_FORWARD:\n" << cur << endl;
+ LYXERR(Debug::DEBUG, "handle LFUN_FINISHED_FORWARD:\n" << cur);
++cur.pos();
cur.setCurrentFont();
break;
break;
default:
- LYXERR(Debug::ACTION)
- << BOOST_CURRENT_FUNCTION
- << ": Command " << cmd
- << " not DISPATCHED by Text" << endl;
+ LYXERR(Debug::ACTION, BOOST_CURRENT_FUNCTION
+ << ": Command " << cmd << " not DISPATCHED by Text");
cur.undispatched();
break;
}
// Inserting characters does not change par height
ParagraphMetrics const & pms
= cur.bv().parMetrics(cur.bottom().text(), cur.bottom().pit());
- if (pms.dim().height()
- == olddim.height()) {
+ if (pms.dim().height() == olddim.height()) {
// if so, update _only_ this paragraph
cur.updateFlags(Update::SinglePar |
Update::FitCursor);
return;
- } else
- needsUpdate = true;
+ }
+ needsUpdate = true;
}
if (!needsUpdate
<< ' ' << quoteName(tempfile.toFilesystemEncoding());
string const command_str = command.str();
- LYXERR(Debug::TCLASS) << "Running `" << command_str << '\'' << endl;
+ LYXERR(Debug::TCLASS, "Running `" << command_str << '\'');
support::cmd_ret const ret =
support::runCommand(command_str);
bool TextClass::readStyle(Lexer & lexrc, Layout & lay)
{
- LYXERR(Debug::TCLASS) << "Reading style " << to_utf8(lay.name()) << endl;
+ LYXERR(Debug::TCLASS, "Reading style " << to_utf8(lay.name()));
if (!lay.read(lexrc, *this)) {
// Resolve fonts
lay.resfont = lay.font;
switch (rt) {
case BASECLASS:
- LYXERR(Debug::TCLASS) << "Reading textclass ";
+ LYXERR(Debug::TCLASS, "Reading textclass ");
break;
case MERGE:
- LYXERR(Debug::TCLASS) << "Reading input file ";
+ LYXERR(Debug::TCLASS, "Reading input file ");
break;
case MODULE:
- LYXERR(Debug::TCLASS) << "Reading module file ";
+ LYXERR(Debug::TCLASS, "Reading module file ");
break;
default:
BOOST_ASSERT(false);
}
- LYXERR(Debug::TCLASS) << to_utf8(makeDisplayPath(filename.absFilename()))
- << endl;
+ LYXERR(Debug::TCLASS, to_utf8(makeDisplayPath(filename.absFilename())));
Lexer lexrc(textClassTags,
sizeof(textClassTags) / sizeof(textClassTags[0]));
}
if (format != FORMAT) {
- LYXERR(Debug::TCLASS) << "Converting layout file from format "
- << format << " to " << FORMAT << endl;
+ LYXERR(Debug::TCLASS, "Converting layout file from format "
+ << format << " to " << FORMAT);
FileName const tempfile(support::tempName());
error = !layout2layout(filename, tempfile);
if (!error)
}
if (rt == MODULE)
- LYXERR(Debug::TCLASS) << "Finished reading module file "
- << to_utf8(makeDisplayPath(filename.absFilename()))
- << endl;
+ LYXERR(Debug::TCLASS, "Finished reading module file "
+ << to_utf8(makeDisplayPath(filename.absFilename())));
else if (rt == MERGE)
- LYXERR(Debug::TCLASS) << "Finished reading input file "
- << to_utf8(makeDisplayPath(filename.absFilename()))
- << endl;
+ LYXERR(Debug::TCLASS, "Finished reading input file "
+ << to_utf8(makeDisplayPath(filename.absFilename())));
else { // we are at top level here.
- LYXERR(Debug::TCLASS) << "Finished reading textclass "
- << to_utf8(makeDisplayPath(filename.absFilename()))
- << endl;
+ LYXERR(Debug::TCLASS, "Finished reading textclass "
+ << to_utf8(makeDisplayPath(filename.absFilename())));
if (defaultlayout_.empty()) {
lyxerr << "Error: Textclass '" << name_
<< "' is missing a defaultstyle." << endl;
toclevel);
}
}
- LYXERR(Debug::TCLASS)
- << "Minimum TocLevel is " << min_toclevel_
- << ", maximum is " << max_toclevel_ <<endl;
+ LYXERR(Debug::TCLASS, "Minimum TocLevel is " << min_toclevel_
+ << ", maximum is " << max_toclevel_);
}
CT_END
};
+
void TextClass::readCounter(Lexer & lexrc)
{
keyword_item counterTags[] = {
lexrc.next();
name = lexrc.getDocString();
if (counters_->hasCounter(name))
- LYXERR(Debug::TCLASS)
- << "Reading existing counter "
- << to_utf8(name) << endl;
+ LYXERR(Debug::TCLASS, "Reading existing counter " << to_utf8(name));
else
- LYXERR(Debug::TCLASS)
- << "Reading new counter "
- << to_utf8(name) << endl;
+ LYXERR(Debug::TCLASS, "Reading new counter " << to_utf8(name));
break;
case CT_WITHIN:
lexrc.next();
{
Lexer lex(0, 0);
support::FileName const real_file = libFileSearch("", "textclass.lst");
- LYXERR(Debug::TCLASS) << "Reading textclasses from `"
- << real_file << '\'' << endl;
+ LYXERR(Debug::TCLASS, "Reading textclasses from `" << real_file << '\'');
if (real_file.empty()) {
lyxerr << "TextClassList::Read: unable to find "
bool finished = false;
// Parse config-file
- LYXERR(Debug::TCLASS) << "Starting parsing of textclass.lst" << endl;
+ LYXERR(Debug::TCLASS, "Starting parsing of textclass.lst");
while (lex.isOK() && !finished) {
- LYXERR(Debug::TCLASS) << "\tline by line" << endl;
+ LYXERR(Debug::TCLASS, "\tline by line");
switch (lex.lex()) {
case Lexer::LEX_FEOF:
finished = true;
break;
default:
string const fname = lex.getString();
- LYXERR(Debug::TCLASS) << "Fname: " << fname << endl;
+ LYXERR(Debug::TCLASS, "Fname: " << fname);
if (lex.next()) {
string const clname = lex.getString();
- LYXERR(Debug::TCLASS) << "Clname: " << clname << endl;
+ LYXERR(Debug::TCLASS, "Clname: " << clname);
if (lex.next()) {
string const desc = lex.getString();
- LYXERR(Debug::TCLASS) << "Desc: " << desc << endl;
+ LYXERR(Debug::TCLASS, "Desc: " << desc);
if (lex.next()) {
bool avail = lex.getBool();
- LYXERR(Debug::TCLASS) << "Avail: " << avail << endl;
+ LYXERR(Debug::TCLASS, "Avail: " << avail);
// This code is run when we have
// fname, clname, desc, and avail
TextClass tmpl(fname, clname, desc, avail);
}
}
}
- LYXERR(Debug::TCLASS) << "End of parsing of textclass.lst" << endl;
+ LYXERR(Debug::TCLASS, "End of parsing of textclass.lst");
// lyx will start with an empty classlist_, but only reconfigure is allowed
// in this case. This gives users a second chance to configure lyx if
// NOTE: latex class name is defined in textclass.layout, which can be different from textclass
FileName const layout_file(addName(path, textclass + ".layout"));
if (layout_file.exists()) {
- LYXERR(Debug::TCLASS) << "Adding class " << textclass << " from directory " << path << endl;
+ LYXERR(Debug::TCLASS, "Adding class " << textclass << " from directory " << path);
// Read .layout file and get description, real latex classname etc
//
// This is a C++ version of function processLayoutFile in configure.py,
// Reads the style files
bool LyXSetStyle()
{
- LYXERR(Debug::TCLASS) << "LyXSetStyle: parsing configuration..." << endl;
+ LYXERR(Debug::TCLASS, "LyXSetStyle: parsing configuration...");
if (!textclasslist.read()) {
- LYXERR(Debug::TCLASS) << "LyXSetStyle: an error occured "
- "during parsing.\n Exiting." << endl;
+ LYXERR(Debug::TCLASS, "LyXSetStyle: an error occured "
+ "during parsing.\n Exiting.");
return false;
}
- LYXERR(Debug::TCLASS) << "LyXSetStyle: configuration parsed." << endl;
+ LYXERR(Debug::TCLASS, "LyXSetStyle: configuration parsed.");
return true;
}
pit_type TextMetrics::getPitNearY(int y)
{
BOOST_ASSERT(!text_->paragraphs().empty());
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
- << ": y: " << y << " cache size: " << par_metrics_.size()
- << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << ": y: " << y << " cache size: " << par_metrics_.size());
// look for highest numbered paragraph with y coordinate less than given y
pit_type pit = 0;
}
for (; it != et; ++it) {
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
<< " examining: pit: " << it->first
- << " y: " << it->second.position()
- << endl;
+ << " y: " << it->second.position());
ParagraphMetrics const & pm = par_metrics_[it->first];
}
}
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
- << ": found best y: " << yy << " for pit: " << pit
- << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << ": found best y: " << yy << " for pit: " << pit);
return pit;
}
ParagraphMetrics const & pm = par_metrics_[pit];
int yy = pm.position() - pm.ascent();
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
- << ": x: " << x
- << " y: " << y
- << " pit: " << pit
- << " yy: " << yy << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << ": x: " << x << " y: " << y << " pit: " << pit << " yy: " << yy);
int r = 0;
BOOST_ASSERT(pm.rows().size());
Row const & row = pm.rows()[r];
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
- << ": row " << r
- << " from pos: " << row.pos()
- << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << ": row " << r << " from pos: " << row.pos());
bool bound = false;
int xx = x;
pos_type const pos = row.pos() + getColumnNearX(pit, row, xx, bound);
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
- << ": setting cursor pit: " << pit
- << " pos: " << pos
- << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << ": setting cursor pit: " << pit << " pos: " << pos);
text_->setCursor(cur, pit, pos, true, bound);
// remember new position.
Paragraph const & par = text_->paragraphs()[pit];
ParagraphMetrics const & pm = par_metrics_[pit];
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
- << ": x: " << x
- << " y: " << y
- << " pit: " << pit
- << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << ": x: " << x << " y: " << y << " pit: " << pit);
+
InsetList::const_iterator iit = par.insetList().begin();
InsetList::const_iterator iend = par.insetList().end();
for (; iit != iend; ++iit) {
Inset * inset = iit->inset;
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
- << ": examining inset " << inset << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << ": examining inset " << inset);
if (!bv_->coordCache().getInsets().has(inset)) {
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
- << ": inset has no cached position" << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << ": inset has no cached position");
return 0;
}
Dimension const & dim = pm.insetDimension(inset);
Point p = bv_->coordCache().getInsets().xy(inset);
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
<< ": xo: " << p.x_ << "..." << p.x_ + dim.wid
- << " yo: " << p.y_ - dim.asc << "..." << p.y_ + dim.des
- << endl;
+ << " yo: " << p.y_ - dim.asc << "..." << p.y_ + dim.des);
if (x >= p.x_
&& x <= p.x_ + dim.wid
&& y >= p.y_ - dim.asc
&& y <= p.y_ + dim.des) {
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
- << ": Hit inset: " << inset << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION
+ << ": Hit inset: " << inset);
return inset;
}
}
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION
- << ": No inset hit. " << endl;
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << ": No inset hit. ");
return 0;
}
// 12 lines lower):
if (lyxerr.debugging(Debug::PAINTING)) {
if (text_->isMainText(bv_->buffer()))
- LYXERR(Debug::PAINTING) << "\n{" << inside <<
- pi.full_repaint << row_has_changed << "}";
+ LYXERR(Debug::PAINTING, "\n{" << inside <<
+ pi.full_repaint << row_has_changed << "}");
else
- LYXERR(Debug::PAINTING) << "[" << inside <<
- pi.full_repaint << row_has_changed << "]";
+ LYXERR(Debug::PAINTING, "[" << inside <<
+ pi.full_repaint << row_has_changed << "]");
}
// Backup full_repaint status and force full repaint
docstring const tooltip = translateIfPossible(lex.getDocString());
lex.next(true);
string const func_arg = lex.getString();
- LYXERR(Debug::PARSER)
- << "ToolbarInfo::read TO_COMMAND func: `"
- << func_arg << '\'' << endl;
+ LYXERR(Debug::PARSER, "ToolbarInfo::read TO_COMMAND func: `"
+ << func_arg << '\'');
FuncRequest func =
lyxaction.lookupFunc(func_arg);
switch (lex.lex()) {
case KMOD:
{
- LYXERR(Debug::KBMAP) << "KMOD:\t" << lex.getString() << endl;
-
- if (lex.next(true)) {
- LYXERR(Debug::KBMAP) << "key\t`" << lex.getString()
- << '\'' << endl;
- } else
+ LYXERR(Debug::KBMAP, "KMOD:\t" << lex.getString());
+ if (!lex.next(true))
return -1;
+ LYXERR(Debug::KBMAP, "key\t`" << lex.getString() << '\'');
+
docstring const keys = lex.getDocString();
- if (lex.next(true)) {
- LYXERR(Debug::KBMAP) << "accent\t`" << lex.getString()
- << '\'' << endl;
- } else
+ if (!lex.next(true))
return -1;
+ LYXERR(Debug::KBMAP, "accent\t`" << lex.getString() << '\'');
+
tex_accent accent = getkeymod(lex.getString());
if (accent == TEX_NOACCENT)
// FIXME: This code should be removed...
// But we need to fix up all the kmap files first
// so that this field is not present anymore.
- if (lex.next(true)) {
- LYXERR(Debug::KBMAP) << "allowed\t`" << lex.getString()
- << '\'' << endl;
- } else
+ if (!lex.next(true))
return -1;
+ LYXERR(Debug::KBMAP, "allowed\t`" << lex.getString() << '\'');
+
/* string const allowed = lex.getString(); */
addDeadkey(accent, keys /*, allowed*/);
#else
case KCOMB: {
string str;
- LYXERR(Debug::KBMAP) << "KCOMB:" << endl;
- if (lex.next(true)) {
- str = lex.getString();
- LYXERR(Debug::KBMAP) << str << endl;
- } else
+ LYXERR(Debug::KBMAP, "KCOMB:");
+ if (!lex.next(true))
return -1;
+ str = lex.getString();
+ LYXERR(Debug::KBMAP, str);
+
tex_accent accent_1 = getkeymod(str);
- if (accent_1 == TEX_NOACCENT) return -1;
+ if (accent_1 == TEX_NOACCENT)
+ return -1;
- if (lex.next(true)) {
- str = lex.getString();
- LYXERR(Debug::KBMAP) << str << endl;
- } else
+ if (!lex.next(true))
return -1;
+ str = lex.getString();
+ LYXERR(Debug::KBMAP, str);
+
tex_accent accent_2 = getkeymod(str);
if (accent_2 == TEX_NOACCENT) return -1;
kmod_list_.find(accent_1);
map<tex_accent, KmodInfo>::iterator it2 =
kmod_list_.find(accent_2);
- if (it1 == kmod_list_.end()
- || it2 == kmod_list_.end()) {
+ if (it1 == kmod_list_.end() || it2 == kmod_list_.end())
return -1;
- }
// Find what key accent_2 is on - should
// check about accent_1 also
break;
}
docstring allowed;
- if (lex.next()) {
- allowed = lex.getDocString();
- LYXERR(Debug::KBMAP) << "allowed: "
- << to_utf8(allowed) << endl;
- } else {
+ if (!lex.next())
return -1;
- }
+
+ allowed = lex.getDocString();
+ LYXERR(Debug::KBMAP, "allowed: " << to_utf8(allowed));
insertException(kmod_list_[accent_1].exception_list,
- it->first, allowed,
- true, accent_2);
+ it->first, allowed, true, accent_2);
}
break;
case KMAP: {
unsigned char key_from;
- LYXERR(Debug::KBMAP) << "KMAP:\t" << lex.getString() << endl;
+ LYXERR(Debug::KBMAP, "KMAP:\t" << lex.getString());
- if (lex.next(true)) {
- key_from = lex.getString()[0];
- LYXERR(Debug::KBMAP) << "\t`" << lex.getString() << '\''
- << endl;
- } else
+ if (!lex.next(true))
return -1;
- if (lex.next(true)) {
- docstring const string_to = lex.getDocString();
- keymap_[key_from] = string_to;
- LYXERR(Debug::KBMAP) << "\t`" << to_utf8(string_to) << '\''
- << endl;
- } else
+ key_from = lex.getString()[0];
+ LYXERR(Debug::KBMAP, "\t`" << lex.getString() << '\'');
+
+ if (!lex.next(true))
return -1;
+ docstring const string_to = lex.getDocString();
+ keymap_[key_from] = string_to;
+ LYXERR(Debug::KBMAP, "\t`" << to_utf8(string_to) << '\'');
break;
}
case KXMOD: {
char_type key;
docstring str;
- LYXERR(Debug::KBMAP) << "KXMOD:\t" << lex.getString() << endl;
+ LYXERR(Debug::KBMAP, "KXMOD:\t" << lex.getString());
- if (lex.next(true)) {
- LYXERR(Debug::KBMAP) << "\t`" << lex.getString() << '\''
- << endl;
- accent = getkeymod(lex.getString());
- } else
+ if (!lex.next(true))
return -1;
- if (lex.next(true)) {
- LYXERR(Debug::KBMAP) << "\t`" << lex.getString() << '\''
- << endl;
- key = lex.getDocString()[0];
- } else
+ LYXERR(Debug::KBMAP, "\t`" << lex.getString() << '\'');
+ accent = getkeymod(lex.getString());
+
+ if (!lex.next(true))
return -1;
- if (lex.next(true)) {
- LYXERR(Debug::KBMAP) << "\t`" << lex.getString() << '\''
- << endl;
- str = lex.getDocString();
- } else
+ LYXERR(Debug::KBMAP, "\t`" << lex.getString() << '\'');
+ key = lex.getDocString()[0];
+
+ if (!lex.next(true))
return -1;
+ LYXERR(Debug::KBMAP, "\t`" << lex.getString() << '\'');
+ str = lex.getDocString();
+
insertException(kmod_list_[accent].exception_list,
key, str);
break;
}
case Lexer::LEX_FEOF:
- LYXERR(Debug::PARSER) << "End of parsing" << endl;
+ LYXERR(Debug::PARSER, "End of parsing");
break;
default:
- lex.printError("ParseKeymapFile: "
- "Unknown tag: `$$Token'");
+ lex.printError("ParseKeymapFile: Unknown tag: `$$Token'");
return -1;
}
}
bool Trans::isAccentDefined(tex_accent accent, KmodInfo & i) const
{
map<tex_accent, KmodInfo>::const_iterator cit = kmod_list_.find(accent);
- if (cit != kmod_list_.end()) {
- i = cit->second;
- return true;
- }
- return false;
+ if (cit == kmod_list_.end())
+ return false;
+ i = cit->second;
+ return true;
}
{
docstring const t = match(c);
- if (t.empty() && c != 0) {
+ if (t.empty() && c != 0)
return k.normalkey(c);
- } else if (!t.empty() && t[0] != 0) {
- //return k.normalkey(c);
- return t;
- } else {
- return k.deadkey(c,
- kmod_list_[static_cast<tex_accent>(t[1])]);
- }
+
+ if (!t.empty() && t[0] != 0)
+ return t; //return k.normalkey(c);
+
+ return k.deadkey(c, kmod_list_[static_cast<tex_accent>(t[1])]);
}
/* return modifier - decoded from p and update p */
{
for (int i = 1; i <= TEX_MAX_ACCENT; ++i) {
- LYXERR(Debug::KBMAP) << "p = " << p
+ LYXERR(Debug::KBMAP, "p = " << p
<< ", lyx_accent_table[" << i
- << "].name = `" << lyx_accent_table[i].name
- << '\'' << endl;
+ << "].name = `" << lyx_accent_table[i].name << '\'');
if (lyx_accent_table[i].name
&& contains(p, lyx_accent_table[i].name)) {
- LYXERR(Debug::KBMAP) << "Found it!" << endl;
+ LYXERR(Debug::KBMAP, "Found it!");
return static_cast<tex_accent>(i);
}
}
// TransFSM
-TransFSM::TransFSM():
- TransFSMData(),
- TransInitState(),
- TransDeadkeyState(),
- TransCombinedState()
+TransFSM::TransFSM()
+ : TransFSMData(), TransInitState(), TransDeadkeyState(), TransCombinedState()
{
currentState = init_state_;
}
if (t1_.isDefined())
active_ = &t1_;
- LYXERR(Debug::KBMAP) << "Enabling primary keymap" << endl;
+ LYXERR(Debug::KBMAP, "Enabling primary keymap");
}
{
if (t2_.isDefined())
active_ = &t2_;
- LYXERR(Debug::KBMAP) << "Enabling secondary keymap" << endl;
+ LYXERR(Debug::KBMAP, "Enabling secondary keymap");
}
void TransManager::disableKeymap()
{
active_ = &default_;
- LYXERR(Debug::KBMAP) << "Disabling keymap" << endl;
+ LYXERR(Debug::KBMAP, "Disabling keymap");
}
void TransManager::insert(docstring const & str, Text * text, Cursor & cur)
{
- for (string::size_type i = 0, n = str.size(); i < n; ++i)
+ for (size_t i = 0, n = str.size(); i != n; ++i)
text->insertChar(cur, str[i]);
}
int VCS::doVCCommand(string const & cmd, FileName const & path)
{
- LYXERR(Debug::LYXVC) << "doVCCommand: " << cmd << endl;
+ LYXERR(Debug::LYXVC, "doVCCommand: " << cmd);
Systemcall one;
support::PathChanger p(path);
int const ret = one.startscript(Systemcall::Wait, cmd);
{
// Check if *,v exists.
FileName tmp(file.absFilename() + ",v");
- LYXERR(Debug::LYXVC) << "Checking if file is under rcs: "
- << tmp << endl;
+ LYXERR(Debug::LYXVC, "Checking if file is under rcs: " << tmp);
if (tmp.isReadable()) {
- LYXERR(Debug::LYXVC) << "Yes " << file
- << " is under rcs." << endl;
+ LYXERR(Debug::LYXVC, "Yes " << file << " is under rcs.");
return tmp;
}
// Check if RCS/*,v exists.
tmp = FileName(addName(addPath(onlyPath(file.absFilename()), "RCS"), file.absFilename()) + ",v");
- LYXERR(Debug::LYXVC) << "Checking if file is under rcs: "
- << tmp << endl;
+ LYXERR(Debug::LYXVC, "Checking if file is under rcs: " << tmp);
if (tmp.isReadable()) {
- LYXERR(Debug::LYXVC) << "Yes " << file
- << " it is under rcs."<< endl;
+ LYXERR(Debug::LYXVC, "Yes " << file << " it is under rcs.");
return tmp;
}
void RCS::retrieve(FileName const & file)
{
- LYXERR(Debug::LYXVC) << "LyXVC::RCS: retrieve.\n\t" << file << endl;
+ LYXERR(Debug::LYXVC, "LyXVC::RCS: retrieve.\n\t" << file);
VCS::doVCCommand("co -q -r " + quoteName(file.toFilesystemEncoding()),
FileName());
}
void RCS::scanMaster()
{
- LYXERR(Debug::LYXVC) << "LyXVC::RCS: scanMaster." << endl;
+ LYXERR(Debug::LYXVC, "LyXVC::RCS: scanMaster.");
ifstream ifs(master_.toFilesystemEncoding().c_str());
bool read_enough = false;
while (!read_enough && ifs >> token) {
- LYXERR(Debug::LYXVC)
- << "LyXVC::scanMaster: current lex text: `"
- << token << '\'' << endl;
+ LYXERR(Debug::LYXVC, "LyXVC::scanMaster: current lex text: `"
+ << token << '\'');
if (token.empty())
continue;
ifs >> tmv;
tmv = rtrim(tmv, ";");
version_ = tmv;
- LYXERR(Debug::LYXVC) << "LyXVC: version found to be "
- << tmv << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: version found to be " << tmv);
} else if (contains(token, "access")
|| contains(token, "symbols")
|| contains(token, "strict")) {
read_enough = true;
} else {
// unexpected
- LYXERR(Debug::LYXVC)
- << "LyXVC::scanMaster(): unexpected token"
- << endl;
+ LYXERR(Debug::LYXVC, "LyXVC::scanMaster(): unexpected token");
}
}
}
void RCS::undoLast()
{
- LYXERR(Debug::LYXVC) << "LyXVC: undoLast" << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: undoLast");
doVCCommand("rcs -o" + version() + " "
+ quoteName(onlyFilename(owner_->absFileName())),
FileName(owner_->filePath()));
// where we have file.
FileName const dir(onlyPath(file.absFilename()) + "/CVS/Entries");
string const tmpf = '/' + onlyFilename(file.absFilename()) + '/';
- LYXERR(Debug::LYXVC) << "LyXVC: checking in `" << dir
- << "' for `" << tmpf << '\'' << endl;
+ LYXERR(Debug::LYXVC, "LyXVC: checking in `" << dir
+ << "' for `" << tmpf << '\'');
if (dir.isReadable()) {
// Ok we are at least in a CVS dir. Parse the CVS/Entries
// and see if we can find this file. We do a fast and
ifstream ifs(dir.toFilesystemEncoding().c_str());
string line;
while (getline(ifs, line)) {
- LYXERR(Debug::LYXVC) << "\tEntries: " << line << endl;
+ LYXERR(Debug::LYXVC, "\tEntries: " << line);
if (contains(line, tmpf))
return dir;
}
void CVS::scanMaster()
{
- LYXERR(Debug::LYXVC) << "LyXVC::CVS: scanMaster. \n Checking: "
- << master_ << endl;
+ LYXERR(Debug::LYXVC, "LyXVC::CVS: scanMaster. \n Checking: " << master_);
// Ok now we do the real scan...
ifstream ifs(master_.toFilesystemEncoding().c_str());
string tmpf = '/' + onlyFilename(file_.absFilename()) + '/';
- LYXERR(Debug::LYXVC) << "\tlooking for `" << tmpf << '\'' << endl;
+ LYXERR(Debug::LYXVC, "\tlooking for `" << tmpf << '\'');
string line;
static regex const reg("/(.*)/(.*)/(.*)/(.*)/(.*)");
while (getline(ifs, line)) {
- LYXERR(Debug::LYXVC) << "\t line: " << line << endl;
+ LYXERR(Debug::LYXVC, "\t line: " << line);
if (contains(line, tmpf)) {
// Ok extract the fields.
smatch sm;
// FIXME: must double check file is stattable/existing
time_t mod = file_.lastModified();
string mod_date = rtrim(asctime(gmtime(&mod)), "\n");
- LYXERR(Debug::LYXVC)
- << "Date in Entries: `" << file_date
- << "'\nModification date of file: `"
- << mod_date << '\'' << endl;
+ LYXERR(Debug::LYXVC, "Date in Entries: `" << file_date
+ << "'\nModification date of file: `" << mod_date << '\'');
if (file_date == mod_date) {
locker_ = "Unlocked";
vcstatus = UNLOCKED;
char const * c = bindtextdomain(PACKAGE, locale_dir.c_str());
int e = errno;
if (e) {
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION << '\n'
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n'
<< "Error code: " << errno << '\n'
<< "Lang, mess: " << lang_ << " " << m << '\n'
<< "Directory : " << package().locale_dir().absFilename() << '\n'
- << "Rtn value : " << c << endl;
+ << "Rtn value : " << c);
}
if (!bind_textdomain_codeset(PACKAGE, ucs4_codeset)) {
- LYXERR(Debug::DEBUG)
- << BOOST_CURRENT_FUNCTION << '\n'
+ LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n'
<< "Error code: " << errno << '\n'
- << "Codeset : " << ucs4_codeset << '\n'
- << endl;
+ << "Codeset : " << ucs4_codeset << '\n');
}
textdomain(PACKAGE);
//lyxerr << "Same as entered returned" << endl;
translated = from_ascii(tmp);
} else {
- LYXERR(Debug::DEBUG) << "We got a translation" << endl;
+ LYXERR(Debug::DEBUG, "We got a translation");
char_type const * ucs4 = reinterpret_cast<char_type const *>(msg);
translated = ucs4;
}
ANY = 0xffffffff
};
- static bool match(type a, type b) {
- return (a & b);
- }
+ static bool match(type a, type b) { return (a & b); }
/** A function to convert symbolic string names on debug levels
to their numerical value.
} // namespace lyx
-#define LYXERR(type) if (!lyx::lyxerr.debugging(type)) ; else lyx::lyxerr
+#define LYXERR(type, msg) \
+ do { if (!lyx::lyxerr.debugging(type)) {} \
+ else lyx::lyxerr << msg << std::endl; } while (0)
#endif
ANY = 0xffffffff
};
- static bool match(type a, type b) {
- return (a & b);
- }
+ static bool match(type a, type b) { return (a & b); }
/** A function to convert symbolic string names on debug levels
to their numerical value.
} // namespace lyx
-#define LYXERR(type) if (!lyx::lyxerr.debugging(type)) ; else lyx::lyxerr
+#define LYXERR(type, msg) \
+ do { \
+ if (!lyx::lyxerr.debugging(type)) {} else lyx::lyxerr << msg << std::endl; \
+ } while (0)
#endif
State tmp = state_machine_[state_][input];
- LYXERR(Debug::GUI) << "Transition from state "
+ LYXERR(Debug::GUI, "Transition from state "
<< printState(state_) << " to state "
<< printState(tmp) << " after input "
- << printInput(input) << std::endl;
+ << printInput(input));
if (tmp != BOGUS) {
state_ = tmp;
void Action::action()
{
- // LYXERR(Debug::ACTION) << "calling LyXFunc::dispatch: func_: "
- // "\n";
+ //LYXERR(Debug::ACTION, "calling LyXFunc::dispatch: func_: ");
lyxView_.dispatch(func_);
triggered(this);
}
bool ButtonController::setReadOnly(bool ro)
{
- LYXERR(Debug::GUI) << "Setting controller ro: " << ro << std::endl;
+ LYXERR(Debug::GUI, "Setting controller ro: " << ro);
policy_.input(ro ?
ButtonPolicy::SMI_READ_ONLY : ButtonPolicy::SMI_READ_WRITE);
void ButtonController::refresh() const
{
- LYXERR(Debug::GUI) << "Calling BC refresh()" << std::endl;
+ LYXERR(Debug::GUI, "Calling BC refresh()");
bool const all_valid = checkWidgets();
if (cancel_) {
bool const enabled = policy().buttonStatus(ButtonPolicy::CANCEL);
if (enabled)
- cancel_->setText(toqstr(_("Cancel")));
+ cancel_->setText(qt_("Cancel"));
else
- cancel_->setText(toqstr(_("Close")));
+ cancel_->setText(qt_("Close"));
}
}
FileFilterList const & filters,
docstring const & suggested)
{
- LYXERR(Debug::GUI) << "Select with path \"" << to_utf8(path)
+ LYXERR(Debug::GUI, "Select with path \"" << to_utf8(path)
<< "\", mask \"" << to_utf8(filters.as_string())
- << "\", suggested \"" << to_utf8(suggested) << '"' << endl;
+ << "\", suggested \"" << to_utf8(suggested) << '"');
FileDialog::Result result;
result.first = FileDialog::Chosen;
if (!suggested.empty())
dlg.selectFile(toqstr(suggested));
- LYXERR(Debug::GUI) << "Synchronous FileDialog: " << endl;
+ LYXERR(Debug::GUI, "Synchronous FileDialog: ");
int res = dlg.exec();
- LYXERR(Debug::GUI) << "result " << res << endl;
+ LYXERR(Debug::GUI, "result " << res);
if (res == QDialog::Accepted)
result.second = from_utf8(internal_path(
fromqstr(dlg.selectedFiles()[0])));
FileFilterList const & filters,
docstring const & suggested)
{
- LYXERR(Debug::GUI) << "Select with path \"" << to_utf8(path)
+ LYXERR(Debug::GUI, "Select with path \"" << to_utf8(path)
<< "\", mask \"" << to_utf8(filters.as_string())
- << "\", suggested \"" << to_utf8(suggested) << '"' << endl;
+ << "\", suggested \"" << to_utf8(suggested) << '"');
FileDialog::Result result;
result.first = FileDialog::Chosen;
if (!suggested.empty())
dlg.selectFile(toqstr(suggested));
- LYXERR(Debug::GUI) << "Synchronous FileDialog: " << endl;
+ LYXERR(Debug::GUI, "Synchronous FileDialog: ");
int res = dlg.exec();
- LYXERR(Debug::GUI) << "result " << res << endl;
+ LYXERR(Debug::GUI, "result " << res);
if (res == QDialog::Accepted)
result.second = from_utf8(internal_path(
fromqstr(dlg.selectedFiles()[0])));
FileDialog::Result const FileDialog::opendir(docstring const & path,
docstring const & suggested)
{
- LYXERR(Debug::GUI) << "Select with path \"" << to_utf8(path)
- << "\", suggested \"" << to_utf8(suggested) << '"' << endl;
+ LYXERR(Debug::GUI, "Select with path \"" << to_utf8(path)
+ << "\", suggested \"" << to_utf8(suggested) << '"');
FileDialog::Result result;
result.first = FileDialog::Chosen;
if (!suggested.empty())
dlg.selectFile(toqstr(suggested));
- LYXERR(Debug::GUI) << "Synchronous FileDialog: " << endl;
+ LYXERR(Debug::GUI, "Synchronous FileDialog: ");
int res = dlg.exec();
- LYXERR(Debug::GUI) << "result " << res << endl;
+ LYXERR(Debug::GUI, "result " << res);
if (res == QDialog::Accepted)
result.second = from_utf8(internal_path(
fromqstr(dlg.selectedFiles()[0])));
installTranslator(&qt_trans_);
// even if the language calls for RtL, don't do that
setLayoutDirection(Qt::LeftToRight);
- LYXERR(Debug::GUI)
- << "Successfully installed Qt translations for locale "
- << fromqstr(language_name) << std::endl;
+ LYXERR(Debug::GUI, "Successfully installed Qt translations for locale "
+ << fromqstr(language_name));
} else
- LYXERR(Debug::GUI)
- << "Could not find Qt translations for locale "
- << fromqstr(language_name) << std::endl;
+ LYXERR(Debug::GUI, "Could not find Qt translations for locale "
+ << fromqstr(language_name));
#ifdef Q_WS_MACX
// This allows to translate the strings that appear in the LyX menu.
case SelectionRequest: {
if (xev->xselectionrequest.selection != XA_PRIMARY)
break;
- LYXERR(Debug::GUI) << "X requested selection." << endl;
+ LYXERR(Debug::GUI, "X requested selection.");
BufferView * bv = currentView()->view();
if (bv) {
docstring const sel = bv->requestSelection();
case SelectionClear: {
if (xev->xselectionclear.selection != XA_PRIMARY)
break;
- LYXERR(Debug::GUI) << "Lost selection." << endl;
+ LYXERR(Debug::GUI, "Lost selection.");
BufferView * bv = currentView()->view();
if (bv)
bv->clearSelection();
// Reset last_searched_string in case of changed option.
if (last_case_sensitive != case_sensitive
|| last_reg_exp != reg_exp) {
- LYXERR(Debug::GUI) << "GuiCitation::findKey: optimisation disabled!" << std::endl;
+ LYXERR(Debug::GUI, "GuiCitation::findKey: optimisation disabled!");
last_searched_string.clear();
}
// save option for next search.
string const GuiClipboard::getAsLyX() const
{
- LYXERR(Debug::ACTION) << "GuiClipboard::getAsLyX(): `";
+ LYXERR(Debug::ACTION, "GuiClipboard::getAsLyX(): `");
// We don't convert encodings here since the encoding of the
// clipboard contents is specified in the data itself
QMimeData const * source =
qApp->clipboard()->mimeData(QClipboard::Clipboard);
if (!source) {
- LYXERR(Debug::ACTION) << "' (no QMimeData)" << endl;
+ LYXERR(Debug::ACTION, "' (no QMimeData)");
return string();
}
if (source->hasFormat(mime_type)) {
// data from ourself or some other LyX instance
QByteArray const ar = source->data(mime_type);
string const s(ar.data(), ar.count());
- LYXERR(Debug::ACTION) << s << "'" << endl;
+ LYXERR(Debug::ACTION, s << "'");
return s;
}
- LYXERR(Debug::ACTION) << "'" << endl;
+ LYXERR(Debug::ACTION, "'");
return string();
}
// text data from other applications
QString const str = qApp->clipboard()->text(QClipboard::Clipboard)
.normalized(QString::NormalizationForm_C);
- LYXERR(Debug::ACTION) << "GuiClipboard::getAsText(): `"
- << fromqstr(str) << "'" << endl;
+ LYXERR(Debug::ACTION, "GuiClipboard::getAsText(): `" << fromqstr(str) << "'");
if (str.isNull())
return docstring();
void GuiClipboard::put(string const & lyx, docstring const & text)
{
- LYXERR(Debug::ACTION) << "GuiClipboard::put(`" << lyx << "' `"
- << to_utf8(text) << "')" << endl;
+ LYXERR(Debug::ACTION, "GuiClipboard::put(`" << lyx << "' `"
+ << to_utf8(text) << "')");
// We don't convert the encoding of lyx since the encoding of the
// clipboard contents is specified in the data itself
QMimeData * data = new QMimeData;
#include <QFontInfo>
#include <QFontDatabase>
-using lyx::support::contains;
-using lyx::support::package;
-using lyx::support::addPath;
-using lyx::support::addName;
-
using std::endl;
using std::make_pair;
namespace lyx {
+using support::contains;
+using support::package;
+using support::addPath;
+using support::addName;
+
extern docstring const stateText(FontInfo const & f);
namespace frontend {
if (family == symbol_fonts[i].family)
return symbol_fonts[i].xlfd;
- LYXERR(Debug::FONT) << "BUG: family not found !" << endl;
+ LYXERR(Debug::FONT, "BUG: family not found !");
return QString();
}
bool isSymbolFamily(FontFamily family)
{
- return family >= SYMBOL_FAMILY &&
- family <= ESINT_FAMILY;
+ return family >= SYMBOL_FAMILY && family <= ESINT_FAMILY;
}
// positions.
QFontInfo fi(font);
- LYXERR(Debug::FONT) << "got: " << fromqstr(fi.family()) << endl;
+ LYXERR(Debug::FONT, "got: " << fromqstr(fi.family()));
if (fi.family().contains(family)) {
- LYXERR(Debug::FONT) << " got it ";
+ LYXERR(Debug::FONT, " got it ");
return true;
}
static pair<QFont, bool> const getSymbolFont(QString const & family)
{
- LYXERR(Debug::FONT) << "Looking for font family "
- << fromqstr(family) << " ... ";
+ LYXERR(Debug::FONT, "Looking for font family "
+ << fromqstr(family) << " ... ");
QString upper = family;
upper[0] = family[0].toUpper();
font.setFamily(family);
if (isChosenFont(font, family)) {
- LYXERR(Debug::FONT) << "normal!" << endl;
+ LYXERR(Debug::FONT, "normal!");
return make_pair<QFont, bool>(font, true);
}
- LYXERR(Debug::FONT) << "Trying " << fromqstr(upper) << " ... ";
+ LYXERR(Debug::FONT, "Trying " << fromqstr(upper) << " ... ");
font.setFamily(upper);
if (isChosenFont(font, upper)) {
- LYXERR(Debug::FONT) << "upper!" << endl;
+ LYXERR(Debug::FONT, "upper!");
return make_pair<QFont, bool>(font, true);
}
// A simple setFamily() fails on Qt 2
QString const rawName = getRawName(family);
- LYXERR(Debug::FONT) << "Trying " << fromqstr(rawName) << " ... ";
+ LYXERR(Debug::FONT, "Trying " << fromqstr(rawName) << " ... ");
font.setRawName(rawName);
if (isChosenFont(font, family)) {
- LYXERR(Debug::FONT) << "raw version!" << endl;
+ LYXERR(Debug::FONT, "raw version!");
return make_pair<QFont, bool>(font, true);
}
- LYXERR(Debug::FONT) << " FAILED :-(" << endl;
+ LYXERR(Debug::FONT, " FAILED :-(");
return make_pair<QFont, bool>(font, false);
}
QString const font_file = fonts_dir + '/' + math_fonts[i] + ".ttf";
int fontID = QFontDatabase::addApplicationFont(font_file);
- LYXERR(Debug::FONT) << "Adding font " << fromqstr(font_file)
+ LYXERR(Debug::FONT, "Adding font " << fromqstr(font_file)
<< static_cast<const char *>
- (fontID < 0 ? " FAIL" : " OK")
- << endl;
+ (fontID < 0 ? " FAIL" : " OK"));
}
for (int i1 = 0; i1 < NUM_FAMILIES; ++i1)
break;
}
- LYXERR(Debug::FONT) << "Font '" << to_utf8(stateText(f))
- << "' matched by\n" << fromqstr(font.family()) << endl;
+ LYXERR(Debug::FONT, "Font '" << to_utf8(stateText(f))
+ << "' matched by\n" << fromqstr(font.family()));
// Is this an exact match?
if (font.exactMatch())
- LYXERR(Debug::FONT) << "This font is an exact match" << endl;
+ LYXERR(Debug::FONT, "This font is an exact match");
else
- LYXERR(Debug::FONT) << "This font is NOT an exact match"
- << endl;
+ LYXERR(Debug::FONT, "This font is NOT an exact match");
- LYXERR(Debug::FONT) << "XFLD: " << fromqstr(font.rawName()) << endl;
+ LYXERR(Debug::FONT, "XFLD: " << fromqstr(font.rawName()));
font.setPointSizeF(convert<double>(lyxrc.font_sizes[f.size()])
* lyxrc.zoom / 100.0);
- LYXERR(Debug::FONT) << "The font has size: "
- << font.pointSizeF() << endl;
+ LYXERR(Debug::FONT, "The font has size: " << font.pointSizeF());
if (f.realShape() != SMALLCAPS_SHAPE) {
metrics.reset(new GuiFontMetrics(font));
- }
- else {
+ } else {
// handle small caps ourselves ...
FontInfo smallfont = f;
smallfont.decSize().decSize().setShape(UP_SHAPE);
void GuiGraphics::change_bb()
{
bbChanged = true;
- LYXERR(Debug::GRAPHICS) << "[bb_Changed set to true]\n";
+ LYXERR(Debug::GRAPHICS, "[bb_Changed set to true]");
changed();
}
Formats::const_iterator end = formats.end();
-// LYXERR(Debug::GRAPHICS)
-// << "D:/msys/home/yns/src/lyx-devel/lib/images/banner.png mis of format: "
-// << fromqstr(Pic.pictureFormat("D:/msys/home/yns/src/lyx-devel/lib/images/banner.png"))
-// << endl;
+// LYXERR(Debug::GRAPHICS,
+// "D:/msys/home/yns/src/lyx-devel/lib/images/banner.png mis of format: "
+// << fromqstr(Pic.pictureFormat("D:/msys/home/yns/src/lyx-devel/lib/images/banner.png")))
// if (Pic.pictureFormat("D:/msys/home/yns/src/lyx-devel/lib/images/banner.png"))
-// LYXERR(Debug::GRAPHICS)
-// << "pictureFormat not returned NULL\n" << endl;
-// << "Supported formats are: " << Pic.inputFormats() << endl;
+// LYXERR(Debug::GRAPHICS, "pictureFormat not returned NULL\n"
+// << "Supported formats are: " << Pic.inputFormats());
QList<QByteArray> qt_formats = QImageReader::supportedImageFormats();
- LYXERR(Debug::GRAPHICS)
- << "\nThe image loader can load the following directly:\n";
+ LYXERR(Debug::GRAPHICS,
+ "\nThe image loader can load the following directly:\n");
- if (qt_formats.empty()) {
- LYXERR(Debug::GRAPHICS)
- << "\nQt4 Problem: No Format available!" << endl;
- }
+ if (qt_formats.empty())
+ LYXERR(Debug::GRAPHICS, "\nQt4 Problem: No Format available!");
for (QList<QByteArray>::const_iterator it = qt_formats.begin(); it != qt_formats.end(); ++it) {
- LYXERR(Debug::GRAPHICS) << (const char *) *it << ", ";
+ LYXERR(Debug::GRAPHICS, (const char *) *it << ", ");
string ext = ascii_lowercase((const char *) *it);
}
if (lyxerr.debugging()) {
- LYXERR(Debug::GRAPHICS)
- << "\nOf these, LyX recognises the following formats:\n";
+ LYXERR(Debug::GRAPHICS, "\nOf these, LyX recognises the following formats:");
FormatList::const_iterator fbegin = fmts.begin();
FormatList::const_iterator fend = fmts.end();
for (FormatList::const_iterator fit = fbegin; fit != fend; ++fit) {
- if (fit != fbegin) {
- LYXERR(Debug::GRAPHICS) << ", ";
- }
- LYXERR(Debug::GRAPHICS) << *fit;
+ if (fit != fbegin)
+ LYXERR(Debug::GRAPHICS, ", ");
+ LYXERR(Debug::GRAPHICS, *fit);
}
- LYXERR(Debug::GRAPHICS) << '\n' << endl;
+ LYXERR(Debug::GRAPHICS, '\n');
}
return fmts;
void GuiImage::load_impl(support::FileName const & filename)
{
if (!original_.isNull()) {
- LYXERR(Debug::GRAPHICS)
- << "Image is loaded already!" << endl;
+ LYXERR(Debug::GRAPHICS, "Image is loaded already!");
finishedLoading(false);
return;
}
if (!original_.load(toqstr(filename.absFilename()))) {
- LYXERR(Debug::GRAPHICS)
- << "Unable to open image" << endl;
+ LYXERR(Debug::GRAPHICS, "Unable to open image");
finishedLoading(false);
return;
}
using lyx::support::getEnv;
+#if 0
static char encode(string const & encoding, QString const & str)
{
typedef map<string, QTextCodec *> EncodingMap;
EncodingMap::const_iterator cit = encoding_map.find(encoding);
if (cit == encoding_map.end()) {
- LYXERR(Debug::KEY) << "Unrecognised encoding '" << encoding
- << "'." << endl;
+ LYXERR(Debug::KEY, "Unrecognised encoding '" << encoding << "'.");
codec = encoding_map.find("")->second;
} else {
codec = cit->second;
}
if (!codec) {
- LYXERR(Debug::KEY) << "No codec for encoding '" << encoding
- << "' found." << endl;
+ LYXERR(Debug::KEY, "No codec for encoding '" << encoding << "' found.");
return 0;
}
- LYXERR(Debug::KEY) << "Using codec " << fromqstr(codec->name()) << endl;
+ LYXERR(Debug::KEY, "Using codec " << fromqstr(codec->name()));
if (!codec->canEncode(str)) {
- LYXERR(Debug::KEY) << "Oof. Can't encode the text !" << endl;
+ LYXERR(Debug::KEY, "Oof. Can't encode the text !");
return 0;
}
return codec->fromUnicode(str).data()[0];
}
+#endif
void setKeySymbol(KeySymbol * sym, QKeyEvent * ev)
{
sym->setKey(ev->key());
if (ev->text().isNull()) {
- LYXERR(Debug::KEY) << "keyevent has isNull() text !" << endl;
+ LYXERR(Debug::KEY, "keyevent has isNull() text !");
sym->setText(docstring());
return;
}
- LYXERR(Debug::KEY) << "Getting key " << ev->key() << ", with text '"
- << fromqstr(ev->text()) << "'" << std::endl;
+ LYXERR(Debug::KEY, "Getting key " << ev->key() << ", with text '"
+ << fromqstr(ev->text()) << "'");
// This is unsafe because ev->text() is the unicode representation of the
// key, not the name of the key. For example, Ctrl-x and Alt-x produce
// different texts.
sym->setText(qstring_to_ucs4(ev->text()));
- LYXERR(Debug::KEY) << "Setting key to " << sym->key() << ", "
- << to_utf8(sym->text()) << endl;
+ LYXERR(Debug::KEY, "Setting key to " << sym->key() << ", "
+ << to_utf8(sym->text()));
}
{
key_ = string_to_qkey(symbolname);
text_ = from_utf8(symbolname);
- LYXERR(Debug::KEY) << "Init key to " << key_ << ", "
- << to_utf8(text_) << endl;
+ LYXERR(Debug::KEY, "Init key to " << key_ << ", " << to_utf8(text_));
}
bool KeySymbol::isOK() const
{
bool const ok = !(text_.empty() && key_ == Qt::Key_unknown);
- LYXERR(Debug::KEY) << "isOK is " << ok << endl;
+ LYXERR(Debug::KEY, "isOK is " << ok);
return ok;
}
bool KeySymbol::isModifier() const
{
bool const mod = q_is_modifier(key_);
- LYXERR(Debug::KEY) << "isMod is " << mod << endl;
+ LYXERR(Debug::KEY, "isModifier is " << mod);
return mod;
}
if (lyxerr.debugging() && text_.size() > 1) {
// We don't know yet how well support the full ucs4 range.
- LYXERR(Debug::KEY) << "KeySymbol::getUCSEncoded()" << endl;
- for (int i = 0; i != int(text_.size()); ++i) {
- LYXERR(Debug::KEY) << "char " << i << ": "
- << int(text_[i]) << endl;
- }
+ LYXERR(Debug::KEY, "KeySymbol::getUCSEncoded()");
+ for (int i = 0; i != int(text_.size()); ++i)
+ LYXERR(Debug::KEY, "char " << i << ": " << int(text_[i]));
}
return text_[0];
{
if (!text_.empty())
return true;
- LYXERR(Debug::KEY) << "text_ empty, isText() == false" << endl;
+ LYXERR(Debug::KEY, "text_ empty, isText() == false");
return false;
}
{
macxMenuBarInit();
- LYXERR(Debug::GUI) << "populating menu bar" << to_utf8(menubackend_.getMenubar().name()) << endl;
+ LYXERR(Debug::GUI, "populating menu bar" << to_utf8(menubackend_.getMenubar().name()));
if (menubackend_.getMenubar().size() == 0) {
- LYXERR(Debug::GUI) << "\tERROR: empty menu bar"
- << to_utf8(menubackend_.getMenubar().name()) << endl;
+ LYXERR(Debug::GUI, "\tERROR: empty menu bar"
+ << to_utf8(menubackend_.getMenubar().name()));
return;
// continue;
}
else {
- LYXERR(Debug::GUI) << "menu bar entries "
- << menubackend_.getMenubar().size();
+ LYXERR(Debug::GUI, "menu bar entries "
+ << menubackend_.getMenubar().size());
}
Menu menu;
for (; m != end; ++m) {
if (m->kind() != MenuItem::Submenu) {
- LYXERR(Debug::GUI) << "\tERROR: not a submenu "
- << to_utf8(m->label()) << endl;
+ LYXERR(Debug::GUI, "\tERROR: not a submenu " << to_utf8(m->label()));
continue;
}
- LYXERR(Debug::GUI) << "menu bar item " << to_utf8(m->label())
- << " is a submenu named " << to_utf8(m->submenuname()) << endl;
+ LYXERR(Debug::GUI, "menu bar item " << to_utf8(m->label())
+ << " is a submenu named " << to_utf8(m->submenuname()));
docstring name = m->submenuname();
if (!menubackend_.hasMenu(name)) {
- LYXERR(Debug::GUI) << "\tERROR: " << to_utf8(name)
- << " submenu has no menu!" << endl;
+ LYXERR(Debug::GUI, "\tERROR: " << to_utf8(name)
+ << " submenu has no menu!");
continue;
}
// We need to draw the text as LTR as we use our own bidi code.
setLayoutDirection(Qt::LeftToRight);
drawText(x, y, str);
- //LYXERR(Debug::PAINTING) << "draw " << std::string(str.toUtf8())
- // << " at " << x << "," << y << std::endl;
+ //LYXERR(Debug::PAINTING, "draw " << std::string(str.toUtf8())
+ // << " at " << x << "," << y);
return textwidth;
}
p.setLayoutDirection(Qt::LeftToRight);
p.drawText(-lb, mA, str);
QPixmapCache::insert(key, pm);
- //LYXERR(Debug::PAINTING) << "h=" << h << " mA=" << mA << " mD=" << mD
+ //LYXERR(Debug::PAINTING, "h=" << h << " mA=" << mA << " mD=" << mD
// << " w=" << w << " lb=" << lb << " tw=" << textwidth
- // << " rb=" << rb << endl;
+ // << " rb=" << rb);
}
// Draw the cached pixmap.
drawPixmap(x + lb, y - mA, pm);
void GuiPopupMenu::updateView()
{
- LYXERR(Debug::GUI) << "GuiPopupMenu::updateView()" << endl;
- LYXERR(Debug::GUI) << "\tTriggered menu: " << to_utf8(name_) << endl;
+ LYXERR(Debug::GUI, "GuiPopupMenu::updateView()"
+ << "\tTriggered menu: " << to_utf8(name_));
clear();
owner_->backend().expand(fromLyxMenu, topLevelMenu_, owner_->view()->buffer());
if (!owner_->backend().hasMenu(topLevelMenu_.name())) {
- LYXERR(Debug::GUI) << "\tWARNING: menu seems empty"
- << to_utf8(topLevelMenu_.name()) << endl;
+ LYXERR(Debug::GUI, "\tWARNING: menu seems empty"
+ << to_utf8(topLevelMenu_.name()));
}
populate(this, &topLevelMenu_);
}
void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu)
{
- LYXERR(Debug::GUI) << "populating menu " << to_utf8(menu->name());
+ LYXERR(Debug::GUI, "populating menu " << to_utf8(menu->name()));
if (menu->size() == 0) {
- LYXERR(Debug::GUI) << "\tERROR: empty menu "
- << to_utf8(menu->name()) << endl;
+ LYXERR(Debug::GUI, "\tERROR: empty menu " << to_utf8(menu->name()));
return;
}
- LYXERR(Debug::GUI) << " ***** menu entries " << menu->size() << endl;
+ LYXERR(Debug::GUI, " ***** menu entries " << menu->size());
Menu::const_iterator m = menu->begin();
Menu::const_iterator end = menu->end();
if (m->kind() == MenuItem::Separator) {
qMenu->addSeparator();
- LYXERR(Debug::GUI) << "adding Menubar Separator" << endl;
+ LYXERR(Debug::GUI, "adding Menubar Separator");
} else if (m->kind() == MenuItem::Submenu) {
- LYXERR(Debug::GUI) << "** creating New Sub-Menu "
- << to_utf8(getLabel(*m)) << endl;
+ LYXERR(Debug::GUI, "** creating New Sub-Menu "
+ << to_utf8(getLabel(*m)));
QMenu * subMenu = qMenu->addMenu(toqstr(getLabel(*m)));
populate(subMenu, m->submenu());
} else { // we have a MenuItem::Command
- LYXERR(Debug::GUI) << "creating Menu Item "
- << to_utf8(m->label()) << endl;
+ LYXERR(Debug::GUI, "creating Menu Item "
+ << to_utf8(m->label()));
docstring label = getLabel(*m);
addBinding(label, *m);
{
QString const str = qApp->clipboard()->text(QClipboard::Selection)
.normalized(QString::NormalizationForm_C);
- LYXERR(Debug::ACTION) << "GuiSelection::get: " << fromqstr(str)
- << endl;
+ LYXERR(Debug::ACTION, "GuiSelection::get: " << fromqstr(str));
if (str.isNull())
return docstring();
void GuiSelection::put(docstring const & str)
{
- LYXERR(Debug::ACTION) << "GuiSelection::put: " << to_utf8(str) << endl;
+ LYXERR(Debug::ACTION, "GuiSelection::put: " << to_utf8(str));
qApp->clipboard()->setText(toqstr(externalLineEnding(str)),
QClipboard::Selection);
bool GuiSpellchecker::initialiseParams(std::string const &)
{
- LYXERR(Debug::GUI) << "Spellchecker::initialiseParams" << endl;
+ LYXERR(Debug::GUI, "Spellchecker::initialiseParams");
speller_ = getSpeller(buffer().params());
if (!speller_)
void GuiSpellchecker::clearParams()
{
- LYXERR(Debug::GUI) << "Spellchecker::clearParams" << endl;
+ LYXERR(Debug::GUI, "Spellchecker::clearParams");
delete speller_;
speller_ = 0;
}
void GuiSpellchecker::check()
{
- LYXERR(Debug::GUI) << "Check the spelling of a word" << endl;
+ LYXERR(Debug::GUI, "Check the spelling of a word");
SpellBase::Result res = SpellBase::OK;
float progress = total ? float(start)/total : 1;
newvalue_ = int(100.0 * progress);
if (newvalue_!= oldval_) {
- LYXERR(Debug::GUI) << "Updating spell progress." << endl;
+ LYXERR(Debug::GUI, "Updating spell progress.");
oldval_ = newvalue_;
// set progress bar
partialUpdate(SPELL_PROGRESSED);
return;
}
- LYXERR(Debug::GUI) << "Found word \"" << to_utf8(getWord()) << "\"" << endl;
+ LYXERR(Debug::GUI, "Found word \"" << to_utf8(getWord()) << "\"");
int const size = cur.selEnd().pos() - cur.selBegin().pos();
cur.pos() -= size;
// set suggestions
if (res != SpellBase::OK && res != SpellBase::IGNORED_WORD) {
- LYXERR(Debug::GUI) << "Found a word needing checking." << endl;
+ LYXERR(Debug::GUI, "Found a word needing checking.");
partialUpdate(SPELL_FOUND_WORD);
}
}
void GuiSpellchecker::replace(docstring const & replacement)
{
- LYXERR(Debug::GUI) << "GuiSpellchecker::replace("
- << to_utf8(replacement) << ")" << std::endl;
+ LYXERR(Debug::GUI, "GuiSpellchecker::replace("
+ << to_utf8(replacement) << ")");
cap::replaceSelectionWithString(bufferview()->cursor(), replacement, true);
buffer().markDirty();
// If we used an LFUN, we would not need that
return 0;
if (toc_models_.empty()) {
- LYXERR(Debug::GUI) << "GuiToc::tocModel(): no types available " << endl;
+ LYXERR(Debug::GUI, "GuiToc::tocModel(): no types available ");
return 0;
}
- LYXERR(Debug::GUI)
- << "GuiToc: type " << type
- << " toc_models_.size() " << toc_models_.size()
- << endl;
+ LYXERR(Debug::GUI, "GuiToc: type " << type
+ << " toc_models_.size() " << toc_models_.size());
BOOST_ASSERT(type >= 0 && type < int(toc_models_.size()));
return toc_models_[type];
{
if (type < 0 || !index.isValid()
|| index.model() != toc_models_[type]) {
- LYXERR(Debug::GUI)
- << "GuiToc::goTo(): QModelIndex is invalid!"
- << endl;
+ LYXERR(Debug::GUI, "GuiToc::goTo(): QModelIndex is invalid!");
return;
}
TocIterator const it = toc_models_[type]->tocIterator(index);
- LYXERR(Debug::GUI) << "GuiToc::goTo " << to_utf8(it->str()) << endl;
+ LYXERR(Debug::GUI, "GuiToc::goTo " << to_utf8(it->str()));
string const tmp = convert<string>(it->id());
lyxview().dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp));
png_name = subst(png_name, "!", "negthinspace");
}
- LYXERR(Debug::GUI) << "find_png(" << name << ")\n"
- << "Looking for math PNG called \""
- << png_name << '"' << std::endl;
+ LYXERR(Debug::GUI, "find_png(" << name << ")\n"
+ << "Looking for math PNG called \"" << png_name << '"');
return png_name;
}
if (pm.load(":/images/" + toqstr(path + name2) + ".png"))
return pm;
- LYXERR(Debug::GUI) << "Cannot find icon for command \""
+ LYXERR(Debug::GUI, "Cannot find icon for command \""
<< lyxaction.getActionName(f.action)
- << '(' << to_utf8(f.argument()) << ")\"" << endl;
+ << '(' << to_utf8(f.argument()) << ")\"");
if (unknown)
pm.load(":/images/unknown.png");
int last_posx = 0;
int last_posy = 0;
for (; tb != te; ++tb) {
- LYXERR(Debug::INIT) << "Adding " << tb->key << " at position "
- << tb->info.posx << " " << tb->info.posy << endl;
+ LYXERR(Debug::INIT, "Adding " << tb->key << " at position "
+ << tb->info.posx << " " << tb->info.posy);
// add toolbar break if posx or posy changes
bool newline = tb->info.location == last_loc && (
// if two toolbars at the same location, assume uninitialized and add toolbar break
}
}
- LYXERR(Debug::GUI) << "Toolbar::display: no toolbar named "
- << name << endl;
+ LYXERR(Debug::GUI, "Toolbar::display: no toolbar named " << name);
}
ToolbarInfo * tbi = toolbarbackend.getUsedToolbarInfo(name);
if (!tbi) {
- LYXERR(Debug::GUI) << "Toolbar::display: no toolbar named "
- << name << endl;
+ LYXERR(Debug::GUI, "Toolbar::display: no toolbar named " << name);
return;
}
void initBackground()
{
- LYXERR(Debug::GUI) << "show banner: " << lyxrc.show_banner << endl;
+ LYXERR(Debug::GUI, "show banner: " << lyxrc.show_banner);
/// The text to be written on top of the pixmap
QString const text = lyx_version ? QString(lyx_version) : qt_("unknown version");
bg_widget_ = new BackgroundWidget(":/images/banner.png", text);
d.splitter_ = new QSplitter;
d.initBackground();
- LYXERR(Debug::GUI) << "stack widget!" << endl;
+ LYXERR(Debug::GUI, "stack widget!");
d.stack_widget_ = new QStackedWidget;
d.stack_widget_->addWidget(d.bg_widget_);
d.stack_widget_->addWidget(d.splitter_);
if (files.isEmpty())
return;
- LYXERR(Debug::GUI) << BOOST_CURRENT_FUNCTION
- << " got URLs!" << endl;
+ LYXERR(Debug::GUI, BOOST_CURRENT_FUNCTION << " got URLs!");
for (int i = 0; i != files.size(); ++i) {
string const file = support::os::internal_path(fromqstr(
files.at(i).toLocalFile()));
void GuiView::autoSave()
{
- LYXERR(Debug::INFO) << "Running autoSave()" << endl;
+ LYXERR(Debug::INFO, "Running autoSave()");
if (buffer())
view()->buffer().autoSave();
// PageStep only depends on the viewport height.
verticalScrollBar()->setPageStep(viewport()->height());
- LYXERR(Debug::GUI) << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::GUI, BOOST_CURRENT_FUNCTION
<< "\n viewport width\t" << viewport()->width()
- << "\n viewport height\t" << viewport()->height()
- << endl;
+ << "\n viewport height\t" << viewport()->height());
// Enables input methods for asian languages.
// Must be set when creating custom text editing widgets.
ViewMetricsInfo const & vi = buffer_view_->viewMetricsInfo();
- LYXERR(Debug::WORKAREA) << "WorkArea::redraw screen" << endl;
+ LYXERR(Debug::WORKAREA, "WorkArea::redraw screen");
int const ymin = std::max(vi.y1, 0);
int const ymax = vi.p2 < vi.size - 1 ? vi.y2 : viewport()->height();
updateScreen();
update(0, ymin, viewport()->width(), ymax - ymin);
- //LYXERR(Debug::WORKAREA)
- //<< " ymin = " << ymin << " width() = " << width()
-// << " ymax-ymin = " << ymax-ymin << std::endl;
+ //LYXERR(Debug::WORKAREA, " ymin = " << ymin << " width() = " << width()
+ // << " ymax-ymin = " << ymax-ymin);
if (lyxerr.debugging(Debug::WORKAREA))
buffer_view_->coordCache().dump();
#ifdef Q_WS_X11
if (XEventsQueued(QX11Info::display(), 0) > 1 && ev->isAutoRepeat()
&& (Qt::Key_PageDown || Qt::Key_PageUp)) {
- LYXERR(Debug::KEY)
- << BOOST_CURRENT_FUNCTION << endl
- << "system is busy: scroll key event ignored" << endl;
+ LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
+ << "\nsystem is busy: scroll key event ignored");
ev->ignore();
return;
}
#endif
- LYXERR(Debug::KEY) << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
<< " count=" << ev->count()
<< " text=" << fromqstr(ev->text())
<< " isAutoRepeat=" << ev->isAutoRepeat()
- << " key=" << ev->key()
- << endl;
+ << " key=" << ev->key());
KeySymbol sym;
setKeySymbol(&sym, ev);
if (!commit_string.isEmpty()) {
- LYXERR(Debug::KEY) << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
<< " preeditString =" << fromqstr(e->preeditString())
- << " commitString =" << fromqstr(e->commitString())
- << endl;
+ << " commitString =" << fromqstr(e->commitString()));
int key = 0;
///
currentWorkAreaChanged(wa);
- LYXERR(Debug::GUI) << "currentTabChanged " << i
- << "File" << bv.buffer().absFileName() << endl;
+ LYXERR(Debug::GUI, "currentTabChanged " << i
+ << "File" << bv.buffer().absFileName());
}
QTreeWidgetItem * item = 0;
QString const name = toqstr(n);
- LYXERR(Debug::GUI) << "addCategory n= " << to_utf8(n) << " parent= " << endl;
+ LYXERR(Debug::GUI, "addCategory n= " << to_utf8(n) << " parent= ");
int depth = 1;
toc_map_.insert( TocPair(top_level_item, iter) );
model_map_[iter] = top_level_item;
- LYXERR(Debug::GUI)
- << "Toc: at depth " << iter->depth()
- << ", added item " << to_utf8(iter->str())
- << endl;
+ LYXERR(Debug::GUI, "Toc: at depth " << iter->depth()
+ << ", added item " << to_utf8(iter->str()));
populate(iter, end, top_level_item);
void TocWidget::selectionChanged(const QModelIndex & current,
const QModelIndex & /*previous*/)
{
- LYXERR(Debug::GUI)
- << "selectionChanged index " << current.row()
- << ", " << current.column()
- << endl;
+ LYXERR(Debug::GUI, "selectionChanged index " << current.row()
+ << ", " << current.column());
form_.goTo(typeCO->currentIndex(), current);
}
void TocWidget::select(QModelIndex const & index)
{
if (!index.isValid()) {
- LYXERR(Debug::GUI)
- << "TocWidget::select(): QModelIndex is invalid!" << endl;
+ LYXERR(Debug::GUI, "TocWidget::select(): QModelIndex is invalid!");
return;
}
void TocWidget::updateView()
{
- LYXERR(Debug::GUI) << "In TocWidget::updateView()" << endl;
+ LYXERR(Debug::GUI, "In TocWidget::updateView()");
select(form_.currentIndex(typeCO->currentIndex()));
}
depthSL->setValue(depth_);
}
- LYXERR(Debug::GUI) << "In TocWidget::updateGui()" << endl;
+ LYXERR(Debug::GUI, "In TocWidget::updateGui()");
select(form_.currentIndex(typeCO->currentIndex()));
if (toc_model) {
- LYXERR(Debug::GUI)
- << "tocModel()->rowCount "
+ LYXERR(Debug::GUI, "tocModel()->rowCount "
<< toc_model->rowCount()
<< "\nform_->tocModel()->columnCount "
- << toc_model->columnCount()
- << endl;
+ << toc_model->columnCount());
}
}
{
// Is the file in the cache already?
if (inCache(file)) {
- LYXERR(Debug::GRAPHICS) << "Cache::add(" << file << "):\n"
- << "The file is already in the cache."
- << std::endl;
+ LYXERR(Debug::GRAPHICS, "Cache::add(" << file << "):\n"
+ << "The file is already in the cache.");
return;
}
void CacheItem::Impl::imageConverted(bool success)
{
string const text = success ? "succeeded" : "failed";
- LYXERR(Debug::GRAPHICS) << "Image conversion " << text << '.' << endl;
+ LYXERR(Debug::GRAPHICS, "Image conversion " << text << '.');
file_to_load_ = converter_.get() ?
FileName(converter_->convertedFile()) : FileName();
success = !file_to_load_.empty() && file_to_load_.isFileReadable();
if (!success) {
- LYXERR(Debug::GRAPHICS) << "Unable to find converted file!"
- << endl;
+ LYXERR(Debug::GRAPHICS, "Unable to find converted file!");
setStatus(ErrorConverting);
if (zipped_)
void CacheItem::Impl::loadImage()
{
setStatus(Loading);
- LYXERR(Debug::GRAPHICS) << "Loading image." << endl;
+ LYXERR(Debug::GRAPHICS, "Loading image.");
image_ = Image::newImage();
void CacheItem::Impl::imageLoaded(bool success)
{
string const text = success ? "succeeded" : "failed";
- LYXERR(Debug::GRAPHICS) << "Image loading " << text << '.' << endl;
+ LYXERR(Debug::GRAPHICS, "Image loading " << text << '.');
// Clean up after loading.
if (zipped_)
if (lyx::graphics::Converter::isReachable(from, *it))
return *it;
else
- LYXERR(Debug::GRAPHICS)
- << "Unable to convert from " << from
- << " to " << *it << std::endl;
+ LYXERR(Debug::GRAPHICS, "Unable to convert from " << from
+ << " to " << *it);
}
// Failed! so we have to try to convert it to PPM format
if (!filename_.isFileReadable()) {
if (status_ != ErrorNoFile) {
setStatus(ErrorNoFile);
- LYXERR(Debug::GRAPHICS)
- << "\tThe file is not readable" << endl;
+ LYXERR(Debug::GRAPHICS, "\tThe file is not readable");
}
return;
}
unzipped_filename_ = tempName(FileName(), filename_.toFilesystemEncoding());
if (unzipped_filename_.empty()) {
setStatus(ErrorConverting);
- LYXERR(Debug::GRAPHICS)
- << "\tCould not create temporary file." << endl;
+ LYXERR(Debug::GRAPHICS, "\tCould not create temporary file.");
return;
}
filename = unzipFile(filename_, unzipped_filename_.toFilesystemEncoding());
}
docstring const displayed_filename = makeDisplayPath(filename_.absFilename());
- LYXERR(Debug::GRAPHICS) << "[graphics::CacheItem::Impl::convertToDisplayFormat]\n"
+ LYXERR(Debug::GRAPHICS, "[CacheItem::Impl::convertToDisplayFormat]\n"
<< "\tAttempting to convert image file: " << filename
- << "\n\twith displayed filename: " << lyx::to_utf8(displayed_filename)
- << endl;
+ << "\n\twith displayed filename: " << to_utf8(displayed_filename));
string const from = formats.getFormatFromFile(filename);
if (from.empty()) {
setStatus(ErrorConverting);
- LYXERR(Debug::GRAPHICS)
- << "\tCould not determine file format." << endl;
+ LYXERR(Debug::GRAPHICS, "\tCould not determine file format.");
}
- LYXERR(Debug::GRAPHICS)
- << "\n\tThe file contains " << from << " format data." << endl;
+ LYXERR(Debug::GRAPHICS, "\n\tThe file contains " << from << " format data.");
to_ = findTargetFormat(from);
if (from == to_) {
// No conversion needed!
- LYXERR(Debug::GRAPHICS) << "\tNo conversion needed (from == to)!" << endl;
+ LYXERR(Debug::GRAPHICS, "\tNo conversion needed (from == to)!");
file_to_load_ = filename;
loadImage();
return;
}
if (ConverterCache::get().inCache(filename, to_)) {
- LYXERR(Debug::GRAPHICS) << "\tNo conversion needed (file in file cache)!"
- << endl;
+ LYXERR(Debug::GRAPHICS, "\tNo conversion needed (file in file cache)!");
file_to_load_ = ConverterCache::get().cacheName(filename, to_);
loadImage();
return;
}
- LYXERR(Debug::GRAPHICS) << "\tConverting it to " << to_ << " format." << endl;
+ LYXERR(Debug::GRAPHICS, "\tConverting it to " << to_ << " format.");
// Add some stuff to create a uniquely named temporary file.
// This file is deleted in loadImage after it is loaded into memory.
string const & from_format, string const & to_format)
: valid_process_(false), finished_(false)
{
- LYXERR(Debug::GRAPHICS) << "Converter c-tor:\n"
+ LYXERR(Debug::GRAPHICS, "Converter c-tor:\n"
<< "\tfrom_file: " << from_file
<< "\n\tto_file_base: " << to_file_base
<< "\n\tfrom_format: " << from_format
- << "\n\tto_format: " << to_format << endl;
+ << "\n\tto_format: " << to_format);
// The converted image is to be stored in this file (we do not
// use ChangeExtension because this is a basename which may
// The conversion commands are stored in a stringstream
ostringstream script;
build_script(from_file, to_file_base, from_format, to_format, script);
- LYXERR(Debug::GRAPHICS) << "\tConversion script:"
- << "\n--------------------------------------\n"
+ LYXERR(Debug::GRAPHICS, "\tConversion script:"
+ "\n--------------------------------------\n"
<< script.str()
- << "\n--------------------------------------\n";
+ << "\n--------------------------------------\n");
// Output the script to file.
static int counter = 0;
ptr = ForkedCallQueue::get().add(script_command_);
ptr->connect(boost::bind(&Impl::converted, this, _1, _2));
-
}
+
void Converter::Impl::converted(pid_t /* pid */, int retval)
{
if (finished_)
ostream & script)
{
BOOST_ASSERT(from_format != to_format);
- LYXERR(Debug::GRAPHICS) << "build_script ... ";
+ LYXERR(Debug::GRAPHICS, "build_script ... ");
typedef Converters::EdgePath EdgePath;
script << "#!/usr/bin/env python\n"
<< to_format << ":' + '\"' + outfile + '\"' + '";
string const command = os.str();
- LYXERR(Debug::GRAPHICS)
- << "\tNo converter defined! I use convertDefault.py\n\t"
- << command << endl;
+ LYXERR(Debug::GRAPHICS,
+ "\tNo converter defined! I use convertDefault.py\n\t"
+ << command);
build_conversion_command(command, script);
}
// The conversion commands may contain these tokens that need to be
// changed to infile, infile_base, outfile respectively.
- string const token_from("$$i");
- string const token_base("$$b");
- string const token_to("$$o");
+ string const token_from = "$$i";
+ string const token_base = "$$b";
+ string const token_to = "$$o";
EdgePath::const_iterator it = edgepath.begin();
EdgePath::const_iterator end = edgepath.end();
// Move the final outfile to to_file
script << move_file("outfile", quoteName(to_file, quote_python));
- LYXERR(Debug::GRAPHICS) << "ready!" << endl;
+ LYXERR(Debug::GRAPHICS, "ready!");
}
} // namespace graphics
-
} // namespace lyx
height = getHeight();
}
- LYXERR(Debug::GRAPHICS)
- << "graphics::Image::getScaledDimensions()"
+ LYXERR(Debug::GRAPHICS, "graphics::Image::getScaledDimensions()"
<< "\n\tparams.scale : " << params.scale
<< "\n\twidth : " << width
- << "\n\theight : " << height
- << std::endl;
+ << "\n\theight : " << height);
return std::make_pair(width, height);
}
void LoaderQueue::loadNext()
{
- LYXERR(Debug::GRAPHICS) << "LoaderQueue: "
- << cache_queue_.size()
- << " items in the queue" << endl;
+ LYXERR(Debug::GRAPHICS, "LoaderQueue: "
+ << cache_queue_.size() << " items in the queue");
int counter = s_numimages_;
while (cache_queue_.size() && counter--) {
Cache::ItemPtr ptr = cache_queue_.front();
{
s_numimages_ = numimages;
s_millisecs_ = millisecs;
- LYXERR(Debug::GRAPHICS) << "LoaderQueue: priority set to "
+ LYXERR(Debug::GRAPHICS, "LoaderQueue: priority set to "
<< s_numimages_ << " images at a time, "
- << s_millisecs_ << " milliseconds between calls"
- << endl;
+ << s_millisecs_ << " milliseconds between calls");
}
void LoaderQueue::startLoader()
{
- LYXERR(Debug::GRAPHICS) << "LoaderQueue: waking up" << endl;
+ LYXERR(Debug::GRAPHICS, "LoaderQueue: waking up");
running_ = true ;
timer.setTimeout(s_millisecs_);
timer.start();
{
timer.stop();
running_ = false ;
- LYXERR(Debug::GRAPHICS) << "LoaderQueue: I'm going to sleep" << endl;
+ LYXERR(Debug::GRAPHICS, "LoaderQueue: I'm going to sleep");
}
font_scaling_factor_ = 0.01 * lyxrc.dpi * lyxrc.zoom *
convert<double>(lyxrc.preview_scale_factor);
- LYXERR(Debug::GRAPHICS) << "The font scaling factor is "
- << font_scaling_factor_ << endl;
+ LYXERR(Debug::GRAPHICS, "The font scaling factor is "
+ << font_scaling_factor_);
if (!pconverter_)
pconverter_ = setConverter();
if (snippet.empty())
return;
- LYXERR(Debug::GRAPHICS) << "adding snippet:\n" << snippet << endl;
+ LYXERR(Debug::GRAPHICS, "adding snippet:\n" << snippet);
pending_.push_back(snippet);
}
if (!buffer_.isFullyLoaded())
return;
- LYXERR(Debug::GRAPHICS) << "PreviewLoader::startLoading()" << endl;
+ LYXERR(Debug::GRAPHICS, "PreviewLoader::startLoading()");
// As used by the LaTeX file and by the resulting image files
string const directory = buffer_.temppath();
return;
if (!of) {
- LYXERR(Debug::GRAPHICS) << "PreviewLoader::startLoading()\n"
- << "Unable to create LaTeX file\n"
- << latexfile << endl;
+ LYXERR(Debug::GRAPHICS, "PreviewLoader::startLoading()\n"
+ << "Unable to create LaTeX file\n" << latexfile);
return;
}
of << "\\batchmode\n";
of << "\n\\end{document}\n";
of.close();
if (of.fail()) {
- LYXERR(Debug::GRAPHICS) << "PreviewLoader::startLoading()\n"
- << "File was not closed properly."
- << endl;
+ LYXERR(Debug::GRAPHICS, "PreviewLoader::startLoading()\n"
+ << "File was not closed properly.");
return;
}
int ret = call.startscript(command, convert_ptr);
if (ret != 0) {
- LYXERR(Debug::GRAPHICS) << "PreviewLoader::startLoading()\n"
- << "Unable to start process\n"
- << command << endl;
+ LYXERR(Debug::GRAPHICS, "PreviewLoader::startLoading()\n"
+ << "Unable to start process\n" << command);
return;
}
string const command = git->second.command;
string const status = retval > 0 ? "failed" : "succeeded";
- LYXERR(Debug::GRAPHICS) << "PreviewLoader::finishedInProgress("
+ LYXERR(Debug::GRAPHICS, "PreviewLoader::finishedInProgress("
<< retval << "): processing " << status
- << " for " << command << endl;
+ << " for " << command);
if (retval > 0)
return;
if (from_checksum != temp_checksum) {
Mover const & mover = getMover(from_format);
if (!mover.copy(params.filename, temp_file)) {
- LYXERR(Debug::EXTERNAL)
- << "external::updateExternal. "
- << "Unable to copy "
- << params.filename << " to " << temp_file << endl;
+ LYXERR(Debug::EXTERNAL, "external::updateExternal. "
+ << "Unable to copy " << params.filename << " to " << temp_file);
return; // FAILURE
}
}
Converters::try_default | Converters::try_cache);
if (!success) {
- LYXERR(Debug::EXTERNAL)
- << "external::updateExternal. "
- << "Unable to convert from "
- << from_format << " to " << to_format << endl;
+ LYXERR(Debug::EXTERNAL, "external::updateExternal. "
+ << "Unable to convert from " << from_format << " to " << to_format);
}
// return success
Template::Formats::const_iterator cit = et.formats.find(format);
if (cit == et.formats.end()) {
- LYXERR(Debug::EXTERNAL)
- << "External template format '" << format
- << "' not specified in template "
- << params.templatename() << endl;
+ LYXERR(Debug::EXTERNAL, "External template format '" << format
+ << "' not specified in template " << params.templatename());
return 0;
}
void Inset::edit(Cursor &, bool)
{
- LYXERR(Debug::INSETS) << BOOST_CURRENT_FUNCTION
- << ": edit left/right" << std::endl;
+ LYXERR(Debug::INSETS, BOOST_CURRENT_FUNCTION << ": edit left/right");
}
Inset * Inset::editXY(Cursor &, int x, int y)
{
- LYXERR(Debug::INSETS) << BOOST_CURRENT_FUNCTION
- << ": x=" << x << " y= " << y
- << std::endl;
+ LYXERR(Debug::INSETS, BOOST_CURRENT_FUNCTION << ": x=" << x << " y= " << y);
return this;
}
bibfiles = split(bibfiles, tmp, ',');
while (!tmp.empty()) {
FileName const file = findtexfile(changeExtension(tmp, "bib"), "bib");
- LYXERR(Debug::LATEX) << "Bibfile: " << file << endl;
+ LYXERR(Debug::LATEX, "Bibfile: " << file);
// If we didn't find a matching file name just fail silently
if (!file.empty())
if (lex.eatLine()) {
setParam("type", lex.getDocString());
- LYXERR(Debug::INSETS) << "FloatList::float_type: "
- << to_ascii(getParam("type")) << endl;
+ LYXERR(Debug::INSETS, "FloatList::float_type: "
+ << to_ascii(getParam("type")));
if (!floats.typeExist(to_ascii(getParam("type"))))
lex.printError("InsetFloatList: Unknown float type: `$$Token'");
- } else
+ } else {
lex.printError("InsetFloatList: Parse error: `$$Token'");
+ }
+
while (lex.isOK()) {
lex.next();
token = lex.getString();
{
// Are we using latex or pdflatex?
if (runparams.flavor == OutputParams::PDFLATEX) {
- LYXERR(Debug::GRAPHICS) << "findTargetFormat: PDF mode" << endl;
+ LYXERR(Debug::GRAPHICS, "findTargetFormat: PDF mode");
Format const * const f = formats.getFormat(format);
// Convert vector graphics to pdf
if (f && f->vectorFormat())
return "png";
}
// If it's postscript, we always do eps.
- LYXERR(Debug::GRAPHICS) << "findTargetFormat: PostScript mode" << endl;
+ LYXERR(Debug::GRAPHICS, "findTargetFormat: PostScript mode");
if (format != "ps")
// any other than ps is changed to eps
return "eps";
{
BOOST_ASSERT(buf.embeddedFiles().enabled());
params_.filename = file;
- LYXERR(Debug::FILES) << "Update InsetGraphic with File "
+ LYXERR(Debug::FILES, "Update InsetGraphic with File "
<< params_.filename.toFilesystemEncoding()
- << ", embedding status: "
- << params_.filename.embedded() << std::endl;
+ << ", embedding status: " << params_.filename.embedded());
}
if (token == "Graphics")
readInsetGraphics(lex, buf.filePath());
else
- LYXERR(Debug::GRAPHICS) << "Not a Graphics inset!" << endl;
+ LYXERR(Debug::GRAPHICS, "Not a Graphics inset!");
// InsetGraphics is read, with filename in params_. We do not know if this file actually
// exists or is embedded so we need to get the 'availableFile' from buf.embeddedFiles()
lex.next();
string const token = lex.getString();
- LYXERR(Debug::GRAPHICS) << "Token: '" << token << '\''
- << endl;
+ LYXERR(Debug::GRAPHICS, "Token: '" << token << '\'');
- if (token.empty()) {
+ if (token.empty())
continue;
- } else if (token == "\\end_inset") {
+
+ if (token == "\\end_inset") {
finished = true;
} else {
if (!params_.Read(lex, token, bufpath))
bool const success = mover.copy(file_in, file_out);
if (!success) {
// FIXME UNICODE
- LYXERR(Debug::GRAPHICS)
- << to_utf8(support::bformat(_("Could not copy the file\n%1$s\n"
+ LYXERR(Debug::GRAPHICS,
+ to_utf8(support::bformat(_("Could not copy the file\n%1$s\n"
"into the temporary directory."),
- from_utf8(file_in.absFilename())))
- << std::endl;
+ from_utf8(file_in.absFilename()))));
}
GraphicsCopyStatus status = success ? SUCCESS : FAILURE;
// this file, but we can't check, because that would
// mean to unzip the file and thereby making the
// noUnzip parameter meaningless.
- LYXERR(Debug::GRAPHICS)
- << "\tpass zipped file to LaTeX.\n";
+ LYXERR(Debug::GRAPHICS, "\tpass zipped file to LaTeX.");
FileName const bb_orig_file = FileName(changeExtension(orig_file, "bb"));
if (runparams.nice) {
// temp_file has been unzipped already and
// orig_file has not changed in the meantime.
temp_file = unzipped_temp_file;
- LYXERR(Debug::GRAPHICS)
- << "\twas already unzipped to " << temp_file
- << endl;
+ LYXERR(Debug::GRAPHICS, "\twas already unzipped to " << temp_file);
} else {
// unzipped_temp_file does not exist or is too old
temp_file = unzipFile(temp_file);
- LYXERR(Debug::GRAPHICS)
- << "\tunzipped to " << temp_file << endl;
+ LYXERR(Debug::GRAPHICS, "\tunzipped to " << temp_file);
}
}
string const from = formats.getFormatFromFile(temp_file);
- if (from.empty()) {
- LYXERR(Debug::GRAPHICS)
- << "\tCould not get file format." << endl;
- }
+ if (from.empty())
+ LYXERR(Debug::GRAPHICS, "\tCould not get file format.");
+
string const to = findTargetFormat(from, runparams);
string const ext = formats.extension(to);
- LYXERR(Debug::GRAPHICS)
- << "\t we have: from " << from << " to " << to << '\n';
+ LYXERR(Debug::GRAPHICS, "\t we have: from " << from << " to " << to);
// We're going to be running the exported buffer through the LaTeX
// compiler, so must ensure that LaTeX can cope with the graphics
// file format.
- LYXERR(Debug::GRAPHICS)
- << "\tthe orig file is: " << orig_file << endl;
+ LYXERR(Debug::GRAPHICS, "\tthe orig file is: " << orig_file);
if (from == to) {
if (!runparams.nice && getExtension(temp_file.absFilename()) != ext) {
temp_file = new_file;
output_file = changeExtension(output_file, ext);
source_file = FileName(changeExtension(source_file.absFilename(), ext));
- } else
- LYXERR(Debug::GRAPHICS)
- << "Could not rename file `"
- << temp_file << "' to `" << new_file
- << "'." << endl;
+ } else {
+ LYXERR(Debug::GRAPHICS, "Could not rename file `"
+ << temp_file << "' to `" << new_file << "'.");
+ }
}
// The extension of temp_file might be != ext!
runparams.exportdata->addExternalFile(tex_format, source_file,
// Yes if to_file does not exist or if temp_file is newer than to_file
if (compare_timestamps(temp_file, to_file) < 0) {
// FIXME UNICODE
- LYXERR(Debug::GRAPHICS)
- << to_utf8(bformat(_("No conversion of %1$s is needed after all"),
- from_utf8(rel_file)))
- << std::endl;
+ LYXERR(Debug::GRAPHICS,
+ to_utf8(bformat(_("No conversion of %1$s is needed after all"),
+ from_utf8(rel_file))));
runparams.exportdata->addExternalFile(tex_format, to_file,
output_to_file);
runparams.exportdata->addExternalFile("dvi", to_file,
return stripExtensionIfPossible(output_to_file, runparams.nice);
}
- LYXERR(Debug::GRAPHICS)
- << "\tThe original file is " << orig_file << "\n"
+ LYXERR(Debug::GRAPHICS,"\tThe original file is " << orig_file << "\n"
<< "\tA copy has been made and convert is to be called with:\n"
<< "\tfile to convert = " << temp_file << '\n'
- << "\t from " << from << " to " << to << '\n';
+ << "\t from " << from << " to " << to);
// FIXME (Abdel 12/08/06): Is there a need to show these errors?
ErrorList el;
{
// If there is no file specified or not existing,
// just output a message about it in the latex output.
- LYXERR(Debug::GRAPHICS)
- << "insetgraphics::latex: Filename = "
- << params().filename.absFilename() << endl;
+ LYXERR(Debug::GRAPHICS, "insetgraphics::latex: Filename = "
+ << params().filename.absFilename());
string const relative_file =
params().filename.relFilename(buf.filePath());
// "filename" found. In this case LaTeX
// draws only a rectangle with the above bb and the
// not found filename in it.
- LYXERR(Debug::GRAPHICS)
- << "\tMessage = \"" << message << '\"' << endl;
+ LYXERR(Debug::GRAPHICS, "\tMessage = \"" << message << '\"');
// These variables collect all the latex code that should be before and
// after the actual includegraphics command.
// Write the options if there are any.
string const opts = createLatexOptions();
- LYXERR(Debug::GRAPHICS) << "\tOpts = " << opts << endl;
+ LYXERR(Debug::GRAPHICS, "\tOpts = " << opts);
if (!opts.empty() && !message.empty())
before += ('[' + opts + ',' + message + ']');
else if (!opts.empty() || !message.empty())
before += ('[' + opts + message + ']');
- LYXERR(Debug::GRAPHICS)
- << "\tBefore = " << before
- << "\n\tafter = " << after << endl;
+ LYXERR(Debug::GRAPHICS, "\tBefore = " << before << "\n\tafter = " << after);
string latex_str = before + '{';
// Convert the file if necessary.
// FIXME UNICODE
os << from_utf8(latex_str);
- LYXERR(Debug::GRAPHICS) << "InsetGraphics::latex outputting:\n"
- << latex_str << endl;
+ LYXERR(Debug::GRAPHICS, "InsetGraphics::latex outputting:\n" << latex_str);
// Return how many newlines we issued.
return int(std::count(latex_str.begin(), latex_str.end(),'\n'));
}
}
-namespace {
-
-int writeImageObject(char const * format,
- odocstream & os,
- OutputParams const & runparams,
- docstring const & graphic_label,
- docstring const & attributes)
+static int writeImageObject(char const * format, odocstream & os,
+ OutputParams const & runparams, docstring const & graphic_label,
+ docstring const & attributes)
{
- if (runparams.flavor != OutputParams::XML) {
- os << "<![ %output.print."
- << format
- << "; ["
- << std::endl;
- }
- os <<"<imageobject><imagedata fileref=\"&"
- << graphic_label
- << ";."
- << format
- << "\" "
- << attributes;
- if (runparams.flavor == OutputParams::XML) {
- os << " role=\"" << format << "\"/>" ;
- }
- else {
- os << " format=\"" << format << "\">" ;
- }
- os << "</imageobject>";
- if (runparams.flavor != OutputParams::XML) {
- os << std::endl << "]]>" ;
- }
- return runparams.flavor == OutputParams::XML ? 0 : 2;
-}
-// end anonymous namespace
+ if (runparams.flavor != OutputParams::XML)
+ os << "<![ %output.print." << format
+ << "; [" << std::endl;
+
+ os <<"<imageobject><imagedata fileref=\"&"
+ << graphic_label
+ << ";."
+ << format
+ << "\" "
+ << attributes;
+
+ if (runparams.flavor == OutputParams::XML)
+ os << " role=\"" << format << "\"/>" ;
+ else
+ os << " format=\"" << format << "\">" ;
+
+ os << "</imageobject>";
+
+ if (runparams.flavor != OutputParams::XML)
+ os << std::endl << "]]>" ;
+
+ return runparams.flavor == OutputParams::XML ? 0 : 2;
}
// In DocBook v5.0, the graphic tag will be eliminated from DocBook, will
// need to switch to MediaObject. However, for now this is sufficient and
// easier to use.
- if (runparams.flavor == OutputParams::XML) {
+ if (runparams.flavor == OutputParams::XML)
runparams.exportdata->addExternalFile("docbook-xml",
params().filename);
- } else {
+ else
runparams.exportdata->addExternalFile("docbook",
params().filename);
- }
+
os << "<inlinemediaobject>";
int r = 0;
// Get the original Bounding Box from the file
string const tmp = readBB_from_PSFile(filename);
- LYXERR(Debug::GRAPHICS) << "BB_from_File: " << tmp << std::endl;
+ LYXERR(Debug::GRAPHICS, "BB_from_File: " << tmp);
if (!tmp.empty()) {
// FIXME: why not convert to unsigned int? (Lgb)
unsigned int const bb_orig_xl = convert<int>(token(tmp, ' ', 0));
using support::subst;
using support::sum;
-using std::endl;
using std::find;
using std::string;
using std::istringstream;
"when running the exported file through LaTeX: ") +
from_utf8(incfile));
}
- LYXERR(Debug::LATEX) << "incfile:" << incfile << endl;
- LYXERR(Debug::LATEX) << "exportfile:" << exportfile << endl;
- LYXERR(Debug::LATEX) << "writefile:" << writefile << endl;
+ LYXERR(Debug::LATEX, "incfile:" << incfile);
+ LYXERR(Debug::LATEX, "exportfile:" << exportfile);
+ LYXERR(Debug::LATEX, "writefile:" << writefile);
if (runparams.inComment || runparams.dryrun) {
//Don't try to load or copy the file if we're
if (checksum_in != checksum_out) {
if (!copy(included_file, writefile)) {
// FIXME UNICODE
- LYXERR(Debug::LATEX)
- << to_utf8(bformat(_("Could not copy the file\n%1$s\n"
+ LYXERR(Debug::LATEX,
+ to_utf8(bformat(_("Could not copy the file\n%1$s\n"
"into the temporary directory."),
- from_utf8(included_file.absFilename())))
- << endl;
+ from_utf8(included_file.absFilename()))));
return 0;
}
}
if (!runparams.nice)
incfile = mangled;
- LYXERR(Debug::LATEX) << "incfile:" << incfile << endl;
- LYXERR(Debug::LATEX) << "exportfile:" << exportfile << endl;
- LYXERR(Debug::LATEX) << "writefile:" << writefile << endl;
+ LYXERR(Debug::LATEX, "incfile:" << incfile);
+ LYXERR(Debug::LATEX, "exportfile:" << exportfile);
+ LYXERR(Debug::LATEX, "writefile:" << writefile);
tmp->makeDocBookFile(writefile, runparams, true);
}
for (idx_type cell = 0, n = cellCount(); cell < n; ++cell)
if (getCellInset(cell).get() == inset) {
- LYXERR(Debug::INSETTEXT) << "Tabular::getCellFromInset: "
- << "cell=" << cell << endl;
+ LYXERR(Debug::INSETTEXT, "Tabular::getCellFromInset: "
+ << "cell=" << cell);
return cell;
}
void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
{
- LYXERR(Debug::DEBUG) << "# InsetTabular::doDispatch: cmd: " << cmd
- << "\n cur:" << cur << endl;
+ LYXERR(Debug::DEBUG, "# InsetTabular::doDispatch: cmd: " << cmd
+ << "\n cur:" << cur);
CursorSlice sl = cur.top();
Cursor & bvcur = cur.bv().cursor();
void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd)
{
- LYXERR(Debug::ACTION) << "InsetText::doDispatch()"
- << " [ cmd.action = "
- << cmd.action << ']' << endl;
+ LYXERR(Debug::ACTION, "InsetText::doDispatch()"
+ << " [ cmd.action = " << cmd.action << ']');
text_.dispatch(cur, cmd);
}
colinfo_[col].lines_ = std::count(
colinfo_[col].special_.begin(),
colinfo_[col].special_.end(), '|');
- LYXERR(Debug::MATHED)
- << "special column separator: `"
- << to_utf8(colinfo_[col].special_)
- << '\'' << endl;
+ LYXERR(Debug::MATHED, "special column separator: `"
+ << to_utf8(colinfo_[col].special_) << '\'');
++col;
colinfo_[col].lines_ = 0;
colinfo_[col].special_.clear();
colinfo_[col].lines_ = std::count(
colinfo_[col].special_.begin(),
colinfo_[col].special_.end(), '|');
- LYXERR(Debug::MATHED)
- << "special column separator: `"
- << to_utf8(colinfo_[col].special_)
- << '\'' << endl;
+ LYXERR(Debug::MATHED, "special column separator: `"
+ << to_utf8(colinfo_[col].special_) << '\'');
}
++col;
colinfo_[col].lines_ = 0;
//}
} else {
if (os.firstitem())
- LYXERR(Debug::MATHED) << "suppressing {} when writing"
- << endl;
+ LYXERR(Debug::MATHED, "suppressing {} when writing");
else
os << "{}";
}
bool Correction::correct(MathAtom & at, char_type c) const
{
- //LYXERR(Debug::MATHED)
- // << "trying to correct ar: " << at << " from: '" << from1_ << '\'' << endl;
+ //LYXERR(Debug::MATHED,
+ // "trying to correct ar: " << at << " from: '" << from1_ << '\'');
if (from2_ != c)
return false;
if (asString(at) != asString(from1_))
return false;
- LYXERR(Debug::MATHED)
- << "match found! subst in " << at
- << " from: '" << from1_ << "' to '" << to_ << '\'' << endl;
+ LYXERR(Debug::MATHED, "match found! subst in " << at
+ << " from: '" << from1_ << "' to '" << to_ << '\'');
at = to_;
return true;
}
void initAutoCorrect()
{
- LYXERR(Debug::MATHED) << "reading autocorrect file" << endl;
+ LYXERR(Debug::MATHED, "reading autocorrect file");
support::FileName const file = libFileSearch(string(), "autocorrect");
if (file.empty()) {
lyxerr << "Could not find autocorrect file" << endl;
ifstream is(file.toFilesystemEncoding().c_str());
while (getline(is, line)) {
if (line.size() == 0 || line[0] == '#') {
- //LYXERR(Debug::MATHED) << "ignoring line '" << line << '\'' << endl;
+ //LYXERR(Debug::MATHED, "ignoring line '" << line << '\'');
continue;
}
idocstringstream il(from_utf8(line));
- //LYXERR(Debug::MATHED) << "line '" << line << '\'' << endl;
+ //LYXERR(Debug::MATHED, "line '" << line << '\'');
Correction corr;
if (corr.read(il)) {
- //LYXERR(Debug::MATHED) << "parsed: '" << corr << '\'' << endl;
+ //LYXERR(Debug::MATHED, "parsed: '" << corr << '\'');
theCorrections.insert(corr);
}
}
- LYXERR(Debug::MATHED) << "done reading autocorrections." << endl;
+ LYXERR(Debug::MATHED, "done reading autocorrections.");
}
return true;
}
- LYXERR(Debug::MATHED)
- << "font " << to_utf8(name) << " not available and I can't fake it"
- << endl;
+ LYXERR(Debug::MATHED,
+ "font " << to_utf8(name) << " not available and I can't fake it");
return false;
}
void initSymbols()
{
support::FileName const filename = libFileSearch(string(), "symbols");
- LYXERR(Debug::MATHED) << "read symbols from " << filename << endl;
+ LYXERR(Debug::MATHED, "read symbols from " << filename);
if (filename.empty()) {
lyxerr << "Could not find symbols file" << endl;
return;
if (is)
is >> tmp.requires;
else {
- LYXERR(Debug::MATHED) << "skipping line '" << line << '\'' << endl;
- LYXERR(Debug::MATHED)
- << to_utf8(tmp.name) << ' ' << to_utf8(tmp.inset) << ' ' << to_utf8(tmp.extra) << endl;
+ LYXERR(Debug::MATHED, "skipping line '" << line << "'\n"
+ << to_utf8(tmp.name) << ' ' << to_utf8(tmp.inset) << ' '
+ << to_utf8(tmp.extra));
continue;
}
docstring symbol_font = from_ascii("lyxsymbol");
if (tmp.extra == "func" || tmp.extra == "funclim" || tmp.extra == "special") {
- LYXERR(Debug::MATHED) << "symbol abuse for " << to_utf8(tmp.name) << endl;
+ LYXERR(Debug::MATHED, "symbol abuse for " << to_utf8(tmp.name));
tmp.draw = tmp.name;
} else if (math_font_available(tmp.inset)) {
- LYXERR(Debug::MATHED) << "symbol available for " << to_utf8(tmp.name) << endl;
+ LYXERR(Debug::MATHED, "symbol available for " << to_utf8(tmp.name));
tmp.draw.push_back(char_type(charid));
} else if (fallbackid && math_font_available(symbol_font)) {
if (tmp.inset == "cmex")
tmp.inset = from_ascii("lyxsymbol");
else
tmp.inset = from_ascii("lyxboldsymbol");
- LYXERR(Debug::MATHED) << "symbol fallback for " << to_utf8(tmp.name) << endl;
+ LYXERR(Debug::MATHED, "symbol fallback for " << to_utf8(tmp.name));
tmp.draw.push_back(char_type(fallbackid));
} else {
- LYXERR(Debug::MATHED) << "faking " << to_utf8(tmp.name) << endl;
+ LYXERR(Debug::MATHED, "faking " << to_utf8(tmp.name));
tmp.draw = tmp.name;
tmp.inset = from_ascii("lyxtex");
}
} else {
// it's a proper inset
- LYXERR(Debug::MATHED) << "inset " << to_utf8(tmp.inset)
- << " used for " << to_utf8(tmp.name)
- << endl;
+ LYXERR(Debug::MATHED, "inset " << to_utf8(tmp.inset)
+ << " used for " << to_utf8(tmp.name));
}
if (theWordList.find(tmp.name) != theWordList.end())
- LYXERR(Debug::MATHED)
- << "readSymbols: inset " << to_utf8(tmp.name)
- << " already exists." << endl;
+ LYXERR(Debug::MATHED, "readSymbols: inset " << to_utf8(tmp.name)
+ << " already exists.");
else
theWordList[tmp.name] = tmp;
- LYXERR(Debug::MATHED)
- << "read symbol '" << to_utf8(tmp.name)
+ LYXERR(Debug::MATHED, "read symbol '" << to_utf8(tmp.name)
<< " inset: " << to_utf8(tmp.inset)
<< " draw: " << int(tmp.draw.empty() ? 0 : tmp.draw[0])
<< " extra: " << to_utf8(tmp.extra)
- << " requires: " << to_utf8(tmp.requires)
- << '\'' << endl;
+ << " requires: " << to_utf8(tmp.requires) << '\'');
}
docstring tmp = from_ascii("cmm");
docstring tmp2 = from_ascii("cmsy");
odocstream & os, TexRow & texrow,
OutputParams const & runparams)
{
- LYXERR(Debug::LATEX) << "TeXDeeper... " << &*pit << endl;
+ LYXERR(Debug::LATEX, "TeXDeeper... " << &*pit);
ParagraphList::const_iterator par = pit;
while (par != paragraphs.end() &&
os, texrow, runparams);
}
}
- LYXERR(Debug::LATEX) << "TeXDeeper...done " << endl;
+ LYXERR(Debug::LATEX, "TeXDeeper...done ");
return par;
}
odocstream & os, TexRow & texrow,
OutputParams const & runparams)
{
- LYXERR(Debug::LATEX) << "TeXEnvironment... " << &*pit << endl;
+ LYXERR(Debug::LATEX, "TeXEnvironment... " << &*pit);
BufferParams const & bparams = buf.params();
texrow.newline();
}
- if (par != paragraphs.end()) {
- LYXERR(Debug::LATEX) << "TeXEnvironment...done " << &*par << endl;
- }
+ if (par != paragraphs.end())
+ LYXERR(Debug::LATEX, "TeXEnvironment...done " << &*par);
+
return par;
}
OutputParams const & runparams_in,
string const & everypar)
{
- LYXERR(Debug::LATEX) << "TeXOnePar... " << &*pit << " '"
- << everypar << "'" << endl;
+ LYXERR(Debug::LATEX, "TeXOnePar... " << &*pit << " '"
+ << everypar << "'");
BufferParams const & bparams = buf.params();
LayoutPtr style;
texrow.newline();
}
- if (boost::next(pit) != paragraphs.end()) {
- LYXERR(Debug::LATEX) << "TeXOnePar...done " << &*boost::next(pit) << endl;
- }
+ if (boost::next(pit) != paragraphs.end())
+ LYXERR(Debug::LATEX, "TeXOnePar...done " << &*boost::next(pit));
return ++pit;
}
|| newEnc.package() == Encoding::none)
return make_pair(false, 0);
- LYXERR(Debug::LATEX) << "Changing LaTeX encoding from "
- << oldEnc.name() << " to "
- << newEnc.name() << endl;
+ LYXERR(Debug::LATEX, "Changing LaTeX encoding from "
+ << oldEnc.name() << " to " << newEnc.name());
os << setEncoding(newEnc.iconvName());
if (bparams.inputenc == "default")
return make_pair(true, 0);
- docstring const inputenc(from_ascii(newEnc.latexName()));
+ docstring const inputenc = from_ascii(newEnc.latexName());
switch (newEnc.package()) {
case Encoding::none:
// shouldn't ever reach here, see above
}
os << "\\inputencoding{" << inputenc << '}';
return make_pair(true, count + 16);
- }
+ }
case Encoding::CJK: {
int count = inputenc.length();
if (oldEnc.package() == Encoding::CJK) {
break;
case '\0':
- LYXERR(Debug::INFO) <<
- "writePlaintextFile: NULL char in structure." << endl;
+ LYXERR(Debug::INFO, "writePlaintextFile: NULL char in structure.");
break;
default:
// marked as unmodified. Otherwise, its change is adopted by the first
// character of the next paragraph.
if (par.lookupChange(par.size()).type != Change::UNCHANGED) {
- LYXERR(Debug::CHANGES) <<
- "merging par with inserted/deleted end-of-par character" << endl;
+ LYXERR(Debug::CHANGES,
+ "merging par with inserted/deleted end-of-par character");
par.setChange(par.size(), Change(Change::UNCHANGED));
}
bool FileName::isDirWritable() const
{
- LYXERR(Debug::FILES) << "isDirWriteable: " << *this << std::endl;
+ LYXERR(Debug::FILES, "isDirWriteable: " << *this);
FileName const tmpfl(tempName(*this, "lyxwritetest"));
bool firstLine = true;
while ((count++ < max_count) && format.empty()) {
if (ifs.eof()) {
- LYXERR(Debug::GRAPHICS)
- << "filetools(getFormatFromContents)\n"
- << "\tFile type not recognised before EOF!"
- << endl;
+ LYXERR(Debug::GRAPHICS, "filetools(getFormatFromContents)\n"
+ << "\tFile type not recognised before EOF!");
break;
}
}
if (!format.empty()) {
- LYXERR(Debug::GRAPHICS)
- << "Recognised Fileformat: " << format << endl;
+ LYXERR(Debug::GRAPHICS, "Recognised Fileformat: " << format);
return format;
}
- LYXERR(Debug::GRAPHICS)
- << "filetools(getFormatFromContents)\n"
- << "\tCouldn't find a known format!\n";
+ LYXERR(Debug::GRAPHICS, "filetools(getFormatFromContents)\n"
+ << "\tCouldn't find a known format!");
return string();
}
void ForkedCallQueue::callback(pid_t, int)
{
- if (callQueue_.empty()) {
+ if (callQueue_.empty())
stopCaller();
- } else {
+ else
callNext();
- }
}
-ForkedCallQueue::ForkedCallQueue() : running_(false)
+
+ForkedCallQueue::ForkedCallQueue()
+ : running_(false)
{}
void ForkedCallQueue::startCaller()
{
- LYXERR(Debug::GRAPHICS) << "ForkedCallQueue: waking up" << endl;
+ LYXERR(Debug::GRAPHICS, "ForkedCallQueue: waking up");
running_ = true ;
callNext();
}
void ForkedCallQueue::stopCaller()
{
running_ = false ;
- LYXERR(Debug::GRAPHICS) << "ForkedCallQueue: I'm going to sleep"
- << endl;
+ LYXERR(Debug::GRAPHICS, "ForkedCallQueue: I'm going to sleep");
}
vector<FileName> dirlist;
if (!(dir.exists() && dir.isDirectory())) {
- LYXERR(Debug::FILES)
- << "Directory \"" << dir
- << "\" does not exist to DirList." << endl;
+ LYXERR(Debug::FILES, "Directory \"" << dir
+ << "\" does not exist to DirList.");
return dirlist;
}
static FileName createTmpDir(FileName const & tempdir, string const & mask)
{
- LYXERR(Debug::FILES)
- << "createTmpDir: tempdir=`" << tempdir << "'\n"
- << "createTmpDir: mask=`" << mask << '\'' << endl;
+ LYXERR(Debug::FILES, "createTmpDir: tempdir=`" << tempdir << "'\n"
+ << "createTmpDir: mask=`" << mask << '\'');
FileName const tmpfl(tempName(tempdir, mask));
// lyx::tempName actually creates a file to make sure that it
cmd_ret const c = runCommand(kpsecmd);
- LYXERR(Debug::LATEX) << "kpse status = " << c.first << '\n'
- << "kpse result = `" << rtrim(c.second, "\n\r")
- << '\'' << endl;
+ LYXERR(Debug::LATEX, "kpse status = " << c.first << '\n'
+ << "kpse result = `" << rtrim(c.second, "\n\r") << '\'');
if (c.first != -1)
return FileName(os::internal_path(rtrim(to_utf8(from_filesystem8bit(c.second)),
"\n\r")));
void readBB_lyxerrMessage(FileName const & file, bool & zipped,
string const & message)
{
- LYXERR(Debug::GRAPHICS) << "[readBB_from_PSFile] "
- << message << std::endl;
+ LYXERR(Debug::GRAPHICS, "[readBB_from_PSFile] " << message);
// FIXME: Why is this func deleting a file? (Lgb)
if (zipped)
unlink(file);
unsigned long sum(FileName const & file)
{
- LYXERR(Debug::FILES) << "lyx::sum() using mmap (lightning fast)"
- << endl;
+ LYXERR(Debug::FILES, "lyx::sum() using mmap (lightning fast)");
int fd = open(file.toFilesystemEncoding().c_str(), O_RDONLY);
if (!fd)
unsigned long sum(FileName const & file)
{
- LYXERR(Debug::FILES) << "lyx::sum() using istreambuf_iterator (fast)"
- << endl;
+ LYXERR(Debug::FILES, "lyx::sum() using istreambuf_iterator (fast)");
// a directory may be passed here so we need to test it. (bug 3622)
if (file.isDirectory())
unsigned long sum(FileName const & file)
{
- LYXERR(Debug::FILES)
- << "lyx::sum() using istream_iterator (slow as a snail)"
- << endl;
+ LYXERR(Debug::FILES, "lyx::sum() using istream_iterator (slow as a snail)");
// a directory may be passed here so we need to test it. (bug 3622)
if (file.isDirectory())
if (windows_style_tex_paths_ && is_absolute_path(p)) {
string dos_path = convert_path(p, PathStyle(windows));
- LYXERR(Debug::LATEX)
- << "<Path correction for LaTeX> ["
- << p << "]->>["
- << dos_path << ']' << endl;
+ LYXERR(Debug::LATEX, "<Path correction for LaTeX> ["
+ << p << "]->>[" << dos_path << ']');
return dos_path;
}
{
string const dos_path = subst(p, "/", "\\");
- LYXERR(Debug::LATEX)
- << "<Win32 path correction> ["
- << p << "]->>["
- << dos_path << ']' << endl;
+ LYXERR(Debug::LATEX, "<Win32 path correction> ["
+ << p << "]->>[" << dos_path << ']');
return dos_path;
}
string const drive = p.substr(0, 2);
string const cygprefix = cygdrive + "/" + drive.substr(0, 1);
string const cygpath = subst(subst(p, '\\', '/'), drive, cygprefix);
- LYXERR(Debug::LATEX)
- << "<Path correction for LaTeX> ["
- << p << "]->>["
- << cygpath << ']' << endl;
+ LYXERR(Debug::LATEX, << "<Path correction for LaTeX> ["
+ << p << "]->>[" << cygpath << ']');
return cygpath;
}
return subst(p, '\\', '/');
#else
# error No x() function.
#endif
- LYXERR(Debug::FILES) << "Temporary file `" << t
- << "' created." << endl;
+ LYXERR(Debug::FILES, "Temporary file `" << t << "' created.");
return FileName(t);
- } else {
- LYXERR(Debug::FILES)
- << "LyX Error: Unable to create temporary file."
- << endl;
- return FileName();
}
+ LYXERR(Debug::FILES, "LyX Error: Unable to create temporary file.");
+ return FileName();
}
} // namespace support