From: André Pönitz Date: Thu, 15 Nov 2007 20:04:51 +0000 (+0000) Subject: reduce line noise X-Git-Tag: 1.6.10~7330 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=e1ce2f92db49d50c688414a32944be8e718faa2e;p=features.git reduce line noise git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21631 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 9817c47e5b..95920be888 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -246,13 +246,13 @@ Buffer::Impl::Impl(Buffer & parent, FileName const & file, bool readonly_) 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. @@ -421,12 +421,12 @@ string Buffer::logName(LogType * type) const 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(); @@ -498,8 +498,8 @@ int Buffer::readHeader(Lexer & lex) 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()) { @@ -676,7 +676,7 @@ bool Buffer::readFile(FileName const & filename) 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")); @@ -802,9 +802,7 @@ Buffer::ReadStatus Buffer::readFile(Lexer & lex, FileName const & filename, << ' ' << 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) { @@ -862,7 +860,7 @@ bool Buffer::save() const 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()); } } @@ -996,8 +994,7 @@ bool Buffer::makeLaTeXFile(FileName const & fname, 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)) @@ -1050,10 +1047,10 @@ void Buffer::writeLaTeXSource(odocstream & os, 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) @@ -1065,7 +1062,7 @@ void Buffer::writeLaTeXSource(odocstream & os, 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 @@ -1109,7 +1106,7 @@ void Buffer::writeLaTeXSource(odocstream & os, 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()) { @@ -1173,20 +1170,17 @@ void Buffer::writeLaTeXSource(odocstream & os, 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 << '.'); } @@ -1212,7 +1206,7 @@ void Buffer::makeDocBookFile(FileName const & fname, OutputParams const & runparams, bool const body_only) { - LYXERR(Debug::LATEX) << "makeDocBookFile..." << endl; + LYXERR(Debug::LATEX, "makeDocBookFile..."); //ofstream ofs; odocfstream ofs; diff --git a/src/BufferList.cpp b/src/BufferList.cpp index e4f752cd58..60f87a0201 100644 --- a/src/BufferList.cpp +++ b/src/BufferList.cpp @@ -185,8 +185,7 @@ Buffer * BufferList::newBuffer(string const & s, bool const ronly) { auto_ptr 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(); } diff --git a/src/BufferView.cpp b/src/BufferView.cpp index befc8c2f85..124303a1b6 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -358,12 +358,11 @@ void BufferView::processUpdateFlags(Update::flags flags) // 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())) @@ -443,11 +442,10 @@ void BufferView::updateScrollbar() 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 @@ -496,8 +494,7 @@ ScrollbarParameters const & BufferView::scrollbarParameters() const 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]; @@ -858,13 +855,12 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd) // << [ 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. @@ -939,14 +935,11 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd) 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 @@ -1354,10 +1347,10 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0) // 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. @@ -1664,13 +1657,11 @@ bool BufferView::singleParUpdate() 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; } @@ -1742,21 +1733,19 @@ void BufferView::updateMetrics() // 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(); } } @@ -1936,7 +1925,7 @@ Point BufferView::getPos(DocIterator const & dit, bool boundary) const 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 @@ -1986,7 +1975,7 @@ void BufferView::draw(frontend::Painter & pain) break; } - LYXERR(Debug::PAINTING) << "\n\t\t*** END DRAWING ***" << endl; + LYXERR(Debug::PAINTING, "\n\t\t*** END DRAWING ***"); } diff --git a/src/Changes.cpp b/src/Changes.cpp index ea99b7fc6d..06e7cd51ea 100644 --- a/src/Changes.cpp +++ b/src/Changes.cpp @@ -97,9 +97,9 @@ void Changes::set(Change const & change, pos_type const pos) 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); @@ -117,14 +117,14 @@ void Changes::set(Change const & change, pos_type const start, pos_type const en 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; @@ -134,7 +134,7 @@ void Changes::set(Change const & change, pos_type const start, pos_type const en } 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; } @@ -142,8 +142,8 @@ void Changes::set(Change const & change, pos_type const start, pos_type const en 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; } @@ -154,9 +154,9 @@ void Changes::set(Change const & change, pos_type const start, pos_type const en // 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 } @@ -166,7 +166,7 @@ void Changes::set(Change const & change, pos_type const start, pos_type const en 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(); @@ -187,8 +187,8 @@ void Changes::erase(pos_type const pos) 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(); @@ -231,10 +231,10 @@ bool Changes::isChanged(pos_type const start, pos_type const end) const 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; } } @@ -247,13 +247,13 @@ void Changes::merge() 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 @@ -264,10 +264,11 @@ void Changes::merge() 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, diff --git a/src/CmdDef.cpp b/src/CmdDef.cpp index 2508fab865..2c309c06dd 100644 --- a/src/CmdDef.cpp +++ b/src/CmdDef.cpp @@ -60,7 +60,7 @@ bool CmdDef::read(string const & def_file) return false; } -// LYXERR(Debug::KBMAP) << "Reading def file:" << tmp << endl; + //LYXERR(Debug::KBMAP, "Reading def file:" << tmp); bool error = false; while (lexrc.isOK()) { diff --git a/src/Color.cpp b/src/Color.cpp index 93f142399c..073eef92aa 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -253,9 +253,8 @@ bool ColorSet::setColor(string const & lyxname, string const &x11name) { 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(infotab.size()), lcname); } diff --git a/src/Converter.cpp b/src/Converter.cpp index 4905ed35d5..a943857341 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -34,7 +34,6 @@ #include "support/Path.h" #include "support/Systemcall.h" -using std::endl; using std::find_if; using std::string; using std::vector; @@ -317,10 +316,8 @@ bool Converters::convert(Buffer const * buffer, 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()) { @@ -366,8 +363,8 @@ bool Converters::convert(Buffer const * buffer, 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() @@ -393,15 +390,14 @@ bool Converters::convert(Buffer const * buffer, 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); } @@ -427,7 +423,7 @@ bool Converters::convert(Buffer const * buffer, 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)); @@ -447,10 +443,8 @@ bool Converters::convert(Buffer const * buffer, 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; @@ -536,8 +530,7 @@ bool Converters::move(string const & fmt, 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 diff --git a/src/ConverterCache.cpp b/src/ConverterCache.cpp index cea102075b..a7b086a2cf 100644 --- a/src/ConverterCache.cpp +++ b/src/ConverterCache.cpp @@ -67,10 +67,9 @@ public: 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; @@ -134,9 +133,8 @@ void ConverterCache::Impl::readIndex() // 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; } @@ -145,18 +143,16 @@ void ConverterCache::Impl::readIndex() // 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; } @@ -262,9 +258,8 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format, 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") { @@ -281,31 +276,25 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format, 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, @@ -318,10 +307,8 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format, 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."); } } @@ -331,8 +318,8 @@ void ConverterCache::remove(FileName const & orig_from, { 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()) @@ -363,25 +350,25 @@ void ConverterCache::remove_all(string const & from_format, 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(); } @@ -392,25 +379,25 @@ bool ConverterCache::inCache(FileName const & orig_from, { 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; } @@ -418,8 +405,8 @@ bool ConverterCache::inCache(FileName const & orig_from, 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); @@ -432,8 +419,8 @@ bool ConverterCache::copy(FileName const & orig_from, string const & to_format, { 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") { diff --git a/src/Cursor.cpp b/src/Cursor.cpp index bebf02e852..ba348aa357 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -119,8 +119,8 @@ namespace { 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; @@ -294,9 +294,8 @@ void Cursor::setCursor(DocIterator const & cur) 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; @@ -308,8 +307,8 @@ void Cursor::dispatch(FuncRequest const & cmd0) 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()); @@ -327,7 +326,7 @@ void Cursor::dispatch(FuncRequest const & cmd0) // 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); @@ -1294,7 +1293,7 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded) 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(); diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 2cab32ff7a..998bd9d9d7 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -674,9 +674,8 @@ void saveSelection(Cursor & cur) 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); } } diff --git a/src/DepTable.cpp b/src/DepTable.cpp index e8258dc419..1279e8cf20 100644 --- a/src/DepTable.cpp +++ b/src/DepTable.cpp @@ -54,9 +54,9 @@ void DepTable::insert(FileName const & f, bool upd) 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); @@ -66,14 +66,14 @@ void DepTable::insert(FileName const & f, bool upd) } 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(); @@ -84,19 +84,19 @@ void DepTable::update() 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; @@ -110,8 +110,8 @@ void DepTable::update() ++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)."); } @@ -217,10 +217,10 @@ void DepTable::write(FileName const & f) const // 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 << ' ' @@ -240,8 +240,8 @@ bool DepTable::read(FileName const & f) 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; } diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index a9769ff8a5..0d8c100211 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -429,22 +429,22 @@ bool DocIterator::fixIfBroken() 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 @@ -462,7 +462,7 @@ bool DocIterator::fixIfBroken() // 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 diff --git a/src/EmbeddedFiles.cpp b/src/EmbeddedFiles.cpp index 446d4d59c4..63d0dcd811 100644 --- a/src/EmbeddedFiles.cpp +++ b/src/EmbeddedFiles.cpp @@ -165,7 +165,7 @@ bool EmbeddedFile::extract(Buffer const * buf) const 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; } @@ -207,7 +207,7 @@ bool EmbeddedFile::updateFromExternalFile(Buffer const * buf) const 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; } @@ -309,7 +309,7 @@ bool EmbeddedFiles::writeFile(DocFileName const & filename) 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; } diff --git a/src/Encoding.cpp b/src/Encoding.cpp index c95748bea1..6a610c1998 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -506,11 +506,9 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile) 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; } @@ -564,7 +562,7 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile) "Unknown package: `$$Token'"); } - LYXERR(Debug::INFO) << "Reading encoding " << name << endl; + LYXERR(Debug::INFO, "Reading encoding " << name); encodinglist[name] = Encoding(name, latexname, iconvname, fixedwidth, package); diff --git a/src/Font.cpp b/src/Font.cpp index c854a36326..dcf7034a1c 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -758,13 +758,9 @@ void Font::validate(LaTeXFeatures & features) const 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: @@ -777,9 +773,7 @@ void Font::validate(LaTeXFeatures & features) const 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? @@ -789,8 +783,7 @@ void Font::validate(LaTeXFeatures & features) const lang_ != latex_language) { features.useLanguage(lang_); - LYXERR(Debug::LATEX) << "Found language " - << lang_->lang() << endl; + LYXERR(Debug::LATEX, "Found language " << lang_->lang()); } } diff --git a/src/Format.cpp b/src/Format.cpp index a28629fad1..9b3b8f8bfd 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -152,9 +152,8 @@ string Formats::getFormatFromFile(FileName const & filename) const 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(); } } @@ -310,7 +309,7 @@ bool Formats::view(Buffer const & buffer, FileName const & filename, 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)); @@ -369,7 +368,7 @@ bool Formats::edit(Buffer const & buffer, FileName const & filename, 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)); diff --git a/src/ISpell.cpp b/src/ISpell.cpp index c0cfe5e441..0475dd4cd1 100644 --- a/src/ISpell.cpp +++ b/src/ISpell.cpp @@ -220,7 +220,7 @@ docstring const from_iconv_encoding(string const & s, string const & encoding) 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(); @@ -314,7 +314,7 @@ ISpell::ISpell(BufferParams const & params, string const & lang) ISpell::~ISpell() { - //LYXERR(Debug::GUI) << "Killing ispell" << endl; + //LYXERR(Debug::GUI, "Killing ispell"); if (in) fclose(in); diff --git a/src/Intl.cpp b/src/Intl.cpp index bdf295e655..3b8fa674dd 100644 --- a/src/Intl.cpp +++ b/src/Intl.cpp @@ -77,7 +77,7 @@ void Intl::keyMapSec() 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(); diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp index 5f90aa3042..01cc435ba4 100644 --- a/src/KeyMap.cpp +++ b/src/KeyMap.cpp @@ -59,9 +59,8 @@ string const KeyMap::printKeySym(KeySymbol const & key, KeyModifier mod) 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); @@ -69,9 +68,8 @@ size_t KeyMap::bind(string const & seq, FuncRequest const & func) 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; @@ -86,9 +84,8 @@ size_t KeyMap::unbind(string const & seq, FuncRequest const & func) 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; } @@ -158,7 +155,7 @@ bool KeyMap::read(string const & bind_file, KeyMap * unbind_map) return false; } - LYXERR(Debug::KBMAP) << "Reading bind file:" << tmp << endl; + LYXERR(Debug::KBMAP, "Reading bind file:" << tmp); bool error = false; while (lexrc.isOK()) { @@ -353,11 +350,9 @@ void KeyMap::bind(KeySequence * seq, FuncRequest const & func, unsigned int r) && 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(); } diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp index f812344485..7c9d8e0778 100644 --- a/src/LaTeX.cpp +++ b/src/LaTeX.cpp @@ -218,7 +218,7 @@ int LaTeX::run(TeXErrors & terr) 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); } @@ -231,23 +231,20 @@ int LaTeX::run(TeXErrors & terr) // 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, @@ -257,13 +254,13 @@ int LaTeX::run(TeXErrors & terr) 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); } @@ -296,7 +293,7 @@ int LaTeX::run(TeXErrors & 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()), @@ -316,7 +313,7 @@ int LaTeX::run(TeXErrors & terr) // "\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); @@ -342,11 +339,8 @@ int LaTeX::run(TeXErrors & terr) 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); @@ -359,9 +353,7 @@ int LaTeX::run(TeXErrors & 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 @@ -375,7 +367,7 @@ int LaTeX::run(TeXErrors & terr) // run makeindex if the .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( @@ -404,7 +396,7 @@ int LaTeX::run(TeXErrors & terr) // 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); @@ -419,7 +411,7 @@ int LaTeX::run(TeXErrors & terr) // Write the dependencies to file. head.write(depfile); - LYXERR(Debug::LATEX) << "Done." << endl; + LYXERR(Debug::LATEX, "Done."); return scanres; } @@ -438,9 +430,8 @@ int LaTeX::startscript() 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); @@ -456,7 +447,7 @@ bool LaTeX::runMakeIndexNomencl(FileName const & file, 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 " @@ -498,7 +489,7 @@ Aux_Info const LaTeX::scanAuxFile(FileName const & file) 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; @@ -518,8 +509,7 @@ void LaTeX::scanAuxFile(FileName const & file, Aux_Info & aux_info) 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)) { @@ -530,8 +520,7 @@ void LaTeX::scanAuxFile(FileName const & file, Aux_Info & aux_info) 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)) { @@ -539,8 +528,7 @@ void LaTeX::scanAuxFile(FileName const & file, Aux_Info & aux_info) // 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); @@ -606,7 +594,7 @@ int LaTeX::scanLogFile(TeXErrors & terr) 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; @@ -622,7 +610,7 @@ int LaTeX::scanLogFile(TeXErrors & terr) token = subst(token, "\r", ""); smatch sub; - LYXERR(Debug::LATEX) << "Log line: " << token << endl; + LYXERR(Debug::LATEX, "Log line: " << token); if (token.empty()) continue; @@ -635,11 +623,10 @@ int LaTeX::scanLogFile(TeXErrors & terr) // 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")) { @@ -661,16 +648,14 @@ int LaTeX::scanLogFile(TeXErrors & terr) 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, "! ") || @@ -718,10 +703,8 @@ int LaTeX::scanLogFile(TeXErrors & terr) 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 { @@ -762,7 +745,7 @@ int LaTeX::scanLogFile(TeXErrors & terr) } } } - LYXERR(Debug::LATEX) << "Log line: " << token << endl; + LYXERR(Debug::LATEX, "Log line: " << token); return retval; } @@ -784,7 +767,7 @@ bool handleFoundFile(string const & ff, DepTable & head) // 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 @@ -796,8 +779,7 @@ bool handleFoundFile(string const & ff, DepTable & head) // 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. @@ -855,22 +837,21 @@ bool handleFoundFile(string const & ff, DepTable & head) // 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; } } @@ -878,12 +859,11 @@ bool handleFoundFile(string const & ff, DepTable & head) 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 diff --git a/src/Language.cpp b/src/Language.cpp index eb5cb066dc..59f49b3643 100644 --- a/src/Language.cpp +++ b/src/Language.cpp @@ -59,7 +59,7 @@ void Languages::read(support::FileName const & filename) lang = lex.getString(); else break; - LYXERR(Debug::INFO) << "Reading language " << lang << endl; + LYXERR(Debug::INFO, "Reading language " << lang); if (lex.next()) babel = lex.getString(); diff --git a/src/Lexer.cpp b/src/Lexer.cpp index e3f1bae89a..2486d52817 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -255,7 +255,7 @@ bool Lexer::Pimpl::setFile(FileName const & filename) 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) @@ -268,14 +268,14 @@ bool Lexer::Pimpl::setFile(FileName const & filename) 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_); @@ -289,8 +289,8 @@ bool Lexer::Pimpl::setFile(FileName const & filename) 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; @@ -333,8 +333,7 @@ bool Lexer::Pimpl::next(bool esc /* = false */) 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'); @@ -422,8 +421,7 @@ bool Lexer::Pimpl::next(bool esc /* = false */) 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) @@ -535,8 +533,7 @@ bool Lexer::Pimpl::eatLine() 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); } @@ -789,8 +786,7 @@ string const Lexer::getLongString(string const & endtoken) 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) @@ -802,8 +798,7 @@ string const Lexer::getLongString(string const & endtoken) 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 diff --git a/src/LyX.cpp b/src/LyX.cpp index c9f462ef90..1089fe9532 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -515,8 +515,8 @@ void LyX::prepareExit() // 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 = @@ -565,9 +565,9 @@ int LyX::init(int & argc, char * argv[]) } // 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; @@ -656,8 +656,7 @@ void LyX::execBatchCommands() 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)); } @@ -917,7 +916,7 @@ bool LyX::init() return false; // Load the layouts - LYXERR(Debug::INIT) << "Reading layouts..." << endl; + LYXERR(Debug::INIT, "Reading layouts..."); if (!LyXSetStyle()) return false; //...and the modules @@ -973,11 +972,10 @@ bool LyX::init() 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 @@ -1099,21 +1097,19 @@ bool LyX::queryUserLyXDir(bool explicit_userdir) 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; - } @@ -1141,14 +1137,12 @@ bool LyX::readUIFile(string const & name, bool include) std::list::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; @@ -1162,15 +1156,14 @@ bool LyX::readUIFile(string const & name, bool include) 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()) { @@ -1216,7 +1209,7 @@ bool LyX::readUIFile(string const & name, bool include) // 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()) { @@ -1232,8 +1225,8 @@ bool LyX::readLanguagesFile(string const & name) 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()) { diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 57c9a50562..6b65f01241 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -385,18 +385,17 @@ void LyXFunc::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer) 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; } @@ -412,9 +411,8 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) 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. @@ -422,9 +420,8 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) 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. @@ -434,11 +431,9 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) 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 @@ -451,9 +446,9 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) // 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) { @@ -461,11 +456,11 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) // 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; @@ -477,8 +472,7 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state) 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); @@ -899,7 +893,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd) 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. @@ -913,10 +907,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd) 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) { @@ -1375,9 +1368,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd) 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: @@ -2077,7 +2069,7 @@ void LyXFunc::sendDispatchMessage(docstring const & msg, FuncRequest const & cmd || 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; @@ -2110,8 +2102,7 @@ void LyXFunc::sendDispatchMessage(docstring const & msg, FuncRequest const & cmd 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); } @@ -2243,8 +2234,8 @@ void LyXFunc::doImport(string const & argument) 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()) { diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 9e048c5ddf..2ecf9dd081 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -312,7 +312,7 @@ int LyXRC::read(FileName const & filename) lexrc.setFile(filename); if (!lexrc.isOK()) return -2; - LYXERR(Debug::LYXRC) << "Reading '" << filename << "'..." << endl; + LYXERR(Debug::LYXRC, "Reading '" << filename << "'..."); return read(lexrc); } @@ -327,7 +327,7 @@ int LyXRC::read(std::istream & is) lexrc.setStream(is); if (!lexrc.isOK()) return -2; - LYXERR(Debug::LYXRC) << "Reading istream..." << endl; + LYXERR(Debug::LYXRC, "Reading istream..."); return read(lexrc); } diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp index cb276fd947..8b9d7c608e 100644 --- a/src/LyXVC.cpp +++ b/src/LyXVC.cpp @@ -107,30 +107,26 @@ void LyXVC::registrer() 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; } @@ -140,8 +136,7 @@ void LyXVC::registrer() 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) { @@ -149,22 +144,21 @@ void LyXVC::checkIn() 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 " @@ -188,11 +182,11 @@ void LyXVC::toggleReadOnly() { 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; } @@ -232,11 +226,10 @@ string const LyXVC::getLogFile() const 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(); } diff --git a/src/MenuBackend.cpp b/src/MenuBackend.cpp index 46cae67507..8368f8e5c3 100644 --- a/src/MenuBackend.cpp +++ b/src/MenuBackend.cpp @@ -143,10 +143,9 @@ docstring const MenuItem::binding(bool forgui) const 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(); } diff --git a/src/Messages.cpp b/src/Messages.cpp index 729a2cb598..fd136d6a56 100644 --- a/src/Messages.cpp +++ b/src/Messages.cpp @@ -57,8 +57,8 @@ Messages::Messages(string const & l) // 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_ << ")"); } @@ -69,19 +69,16 @@ void Messages::init() 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); @@ -142,7 +139,7 @@ docstring const Messages::get(string const & m) const 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(msg); } diff --git a/src/ModuleList.cpp b/src/ModuleList.cpp index b530706f07..c6df6a046e 100644 --- a/src/ModuleList.cpp +++ b/src/ModuleList.cpp @@ -51,8 +51,7 @@ public: 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 " @@ -81,29 +80,29 @@ bool ModuleList::load() 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 pkgs; while (!packages.empty()) { string p; @@ -116,7 +115,7 @@ bool ModuleList::load() } // 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()); diff --git a/src/PSpell.cpp b/src/PSpell.cpp index 3d5f043dcf..547d4ba5ea 100644 --- a/src/PSpell.cpp +++ b/src/PSpell.cpp @@ -35,13 +35,13 @@ PSpell::PSpell(BufferParams const &, string const & lang) : 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); diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 5a3a134386..962a6767d2 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1831,7 +1831,7 @@ bool Paragraph::latex(Buffer const & buf, odocstream & os, TexRow & texrow, OutputParams const & runparams) const { - LYXERR(Debug::LATEX) << "SimpleTeXOnePar... " << this << endl; + LYXERR(Debug::LATEX, "SimpleTeXOnePar... " << this); bool return_value = false; @@ -2076,7 +2076,7 @@ bool Paragraph::latex(Buffer const & buf, runparams.moving_arg); } - LYXERR(Debug::LATEX) << "SimpleTeXOnePar...done " << this << endl; + LYXERR(Debug::LATEX, "SimpleTeXOnePar...done " << this); return return_value; } diff --git a/src/Server.cpp b/src/Server.cpp index d2cd33b373..26cc2033f9 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -125,7 +125,7 @@ LyXComm::LyXComm(std::string const & pip, Server * cli, ClientCallbackfct ccb) 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_) { @@ -136,9 +136,7 @@ void LyXComm::openConnection() 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; } @@ -160,19 +158,17 @@ void LyXComm::openConnection() // 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; } @@ -278,10 +274,9 @@ void LyXComm::read_ready() // 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? @@ -318,7 +313,7 @@ void LyXComm::send(string const & msg) return; } - LYXERR(Debug::LYXSERVER) << "LyXComm: Sending '" << msg << '\'' << endl; + LYXERR(Debug::LYXSERVER, "LyXComm: Sending '" << msg << '\''); if (pipename_.empty()) return; @@ -381,8 +376,7 @@ Server::~Server() // 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(); @@ -425,10 +419,8 @@ void Server::callback(string const & msg) 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 ------------------ @@ -439,9 +431,7 @@ void Server::callback(string const & msg) 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; @@ -450,9 +440,7 @@ void Server::callback(string const & msg) 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 @@ -465,14 +453,11 @@ void Server::callback(string const & msg) 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 " diff --git a/src/ServerSocket.cpp b/src/ServerSocket.cpp index 4a718c0882..829ff3e17b 100644 --- a/src/ServerSocket.cpp +++ b/src/ServerSocket.cpp @@ -69,8 +69,8 @@ ServerSocket::ServerSocket(LyXFunc * f, support::FileName const & addr) 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()); } @@ -85,7 +85,7 @@ ServerSocket::~ServerSocket() << " IO error on closing: " << strerror(errno); } support::unlink(address_); - LYXERR(Debug::LYXSERVER) << "lyx: Server socket quitting" << endl; + LYXERR(Debug::LYXSERVER, "lyx: Server socket quitting"); } @@ -102,8 +102,7 @@ void ServerSocket::serverCallback() 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; } @@ -203,7 +202,7 @@ void ServerSocket::writeln(string const & line) 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_); } @@ -214,8 +213,7 @@ LyXDataSocket::~LyXDataSocket() << " 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."); } @@ -240,8 +238,8 @@ bool LyXDataSocket::readln(string & line) // 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_ @@ -252,8 +250,8 @@ bool LyXDataSocket::readln(string & line) // 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); diff --git a/src/Session.cpp b/src/Session.cpp index 36161e84ea..faaabf17f8 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -78,7 +78,7 @@ void LastFilesSection::read(istream & is) && 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()); } @@ -108,9 +108,8 @@ void LastFilesSection::setNumberOfLastFiles(unsigned int no) 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; } } @@ -131,7 +130,7 @@ void LastOpenedSection::read(istream & is) 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()); } @@ -185,9 +184,9 @@ void LastFilePosSection::read(istream & is) && 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()); } @@ -262,9 +261,9 @@ void BookmarksSection::read(istream & is) 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()); } @@ -335,9 +334,9 @@ void ToolbarSection::read(istream & is) 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 @@ -416,9 +415,9 @@ void SessionInfoSection::read(istream & is) 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()); } @@ -489,7 +488,7 @@ void Session::readFile() 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); } } @@ -508,8 +507,8 @@ void Session::writeFile() const 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); } } diff --git a/src/Text.cpp b/src/Text.cpp index bf77a0c251..0af0731f89 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -310,8 +310,7 @@ void readParagraph(Buffer const & buf, Paragraph & par, Lexer & lex, 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") { diff --git a/src/Text2.cpp b/src/Text2.cpp index 03ff6d75fe..2a0249a523 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -233,7 +233,7 @@ void Text::setLayout(Cursor & cur, docstring const & layout) 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)); @@ -747,7 +747,7 @@ void Text::fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where) 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(); diff --git a/src/Text3.cpp b/src/Text3.cpp index f6e4e4a923..6808b3d78e 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -388,7 +388,7 @@ bool Text::isRTL(Buffer const & buffer, Paragraph const & par) const 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 @@ -955,7 +955,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) 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(); @@ -1551,7 +1551,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) } 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(); @@ -1559,7 +1559,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) 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(); @@ -1567,11 +1567,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) 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; @@ -1729,10 +1729,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) 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; } @@ -1755,14 +1753,13 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) // 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 diff --git a/src/TextClass.cpp b/src/TextClass.cpp index f1b1df7eaa..58dca7a152 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -86,7 +86,7 @@ bool layout2layout(FileName const & filename, FileName const & tempfile) << ' ' << 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); @@ -131,7 +131,7 @@ bool TextClass::isTeXClassAvailable() const 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; @@ -211,19 +211,18 @@ bool TextClass::read(FileName const & filename, ReadType rt) 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])); @@ -444,8 +443,8 @@ bool TextClass::read(FileName const & filename, ReadType rt) } 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) @@ -455,17 +454,14 @@ bool TextClass::read(FileName const & filename, ReadType rt) } 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; @@ -488,9 +484,8 @@ bool TextClass::read(FileName const & filename, ReadType rt) toclevel); } } - LYXERR(Debug::TCLASS) - << "Minimum TocLevel is " << min_toclevel_ - << ", maximum is " << max_toclevel_ <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(); diff --git a/src/TextClassList.cpp b/src/TextClassList.cpp index 87e97cf676..3fcc278e21 100644 --- a/src/TextClassList.cpp +++ b/src/TextClassList.cpp @@ -98,8 +98,7 @@ bool TextClassList::read() { 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 " @@ -131,25 +130,25 @@ bool TextClassList::read() 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); @@ -162,7 +161,7 @@ bool TextClassList::read() } } } - 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 @@ -194,7 +193,7 @@ TextClassList::addTextClass(std::string const & textclass, std::string const & p // 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, @@ -243,15 +242,15 @@ textclass_type defaultTextclass() // 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; } diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 4fab5892cf..dd70909037 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1225,10 +1225,8 @@ void TextMetrics::newParMetricsUp() 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; @@ -1272,11 +1270,9 @@ pit_type TextMetrics::getPitNearY(int y) } 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]; @@ -1286,10 +1282,8 @@ pit_type TextMetrics::getPitNearY(int y) } } - 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; } @@ -1378,12 +1372,8 @@ void TextMetrics::setCursorFromCoordinates(Cursor & cur, int const x, int const 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()); @@ -1396,21 +1386,15 @@ void TextMetrics::setCursorFromCoordinates(Cursor & cur, int const x, int const 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. @@ -1427,51 +1411,41 @@ Inset * TextMetrics::checkInsetHit(int x, int y) 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; } @@ -1975,11 +1949,11 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co // 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 diff --git a/src/ToolbarBackend.cpp b/src/ToolbarBackend.cpp index 8dbe44e725..b58f2c7785 100644 --- a/src/ToolbarBackend.cpp +++ b/src/ToolbarBackend.cpp @@ -135,9 +135,8 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex) 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); diff --git a/src/Trans.cpp b/src/Trans.cpp index 3b3a691640..173958a629 100644 --- a/src/Trans.cpp +++ b/src/Trans.cpp @@ -222,22 +222,19 @@ int Trans::load(Lexer & lex) 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) @@ -247,12 +244,11 @@ int Trans::load(Lexer & lex) // 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 @@ -263,22 +259,23 @@ int Trans::load(Lexer & lex) 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; @@ -286,10 +283,8 @@ int Trans::load(Lexer & lex) kmod_list_.find(accent_1); map::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 @@ -302,39 +297,33 @@ int Trans::load(Lexer & lex) 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: { @@ -342,39 +331,35 @@ int Trans::load(Lexer & lex) 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; } } @@ -385,11 +370,10 @@ int Trans::load(Lexer & lex) bool Trans::isAccentDefined(tex_accent accent, KmodInfo & i) const { map::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; } @@ -397,15 +381,13 @@ docstring const Trans::process(char_type c, TransManager & k) { 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(t[1])]); - } + + if (!t.empty() && t[0] != 0) + return t; //return k.normalkey(c); + + return k.deadkey(c, kmod_list_[static_cast(t[1])]); } @@ -434,14 +416,13 @@ tex_accent getkeymod(string const & p) /* 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(i); } } @@ -596,11 +577,8 @@ docstring const TransCombinedState::deadkey(char_type c, KmodInfo d) // TransFSM -TransFSM::TransFSM(): - TransFSMData(), - TransInitState(), - TransDeadkeyState(), - TransCombinedState() +TransFSM::TransFSM() + : TransFSMData(), TransInitState(), TransDeadkeyState(), TransCombinedState() { currentState = init_state_; } @@ -640,7 +618,7 @@ void TransManager::enablePrimary() if (t1_.isDefined()) active_ = &t1_; - LYXERR(Debug::KBMAP) << "Enabling primary keymap" << endl; + LYXERR(Debug::KBMAP, "Enabling primary keymap"); } @@ -648,14 +626,14 @@ void TransManager::enableSecondary() { 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"); } @@ -675,7 +653,7 @@ void TransManager::translateAndInsert(char_type c, Text * text, Cursor & cur) 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]); } diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index 24076ca0f7..01ad8378e2 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -54,7 +54,7 @@ using std::ifstream; 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); @@ -79,21 +79,17 @@ FileName const RCS::find_file(FileName const & file) { // 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; } @@ -103,7 +99,7 @@ FileName const RCS::find_file(FileName const & file) 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()); } @@ -111,7 +107,7 @@ void RCS::retrieve(FileName const & file) void RCS::scanMaster() { - LYXERR(Debug::LYXVC) << "LyXVC::RCS: scanMaster." << endl; + LYXERR(Debug::LYXVC, "LyXVC::RCS: scanMaster."); ifstream ifs(master_.toFilesystemEncoding().c_str()); @@ -119,9 +115,8 @@ void RCS::scanMaster() 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; @@ -131,8 +126,7 @@ void RCS::scanMaster() 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")) { @@ -165,9 +159,7 @@ void RCS::scanMaster() read_enough = true; } else { // unexpected - LYXERR(Debug::LYXVC) - << "LyXVC::scanMaster(): unexpected token" - << endl; + LYXERR(Debug::LYXVC, "LyXVC::scanMaster(): unexpected token"); } } } @@ -211,7 +203,7 @@ void RCS::revert() 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())); @@ -246,8 +238,8 @@ FileName const CVS::find_file(FileName const & file) // 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 @@ -255,7 +247,7 @@ FileName const CVS::find_file(FileName const & file) 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; } @@ -266,16 +258,15 @@ FileName const CVS::find_file(FileName const & file) 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; @@ -292,10 +283,8 @@ void CVS::scanMaster() // 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; diff --git a/src/client/Messages.cpp b/src/client/Messages.cpp index 27117fd519..ca98849789 100644 --- a/src/client/Messages.cpp +++ b/src/client/Messages.cpp @@ -116,20 +116,17 @@ public: 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); @@ -144,7 +141,7 @@ public: //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(msg); translated = ucs4; } diff --git a/src/client/debug.h b/src/client/debug.h index f0c604a780..5ea84e70ea 100644 --- a/src/client/debug.h +++ b/src/client/debug.h @@ -37,9 +37,7 @@ public: 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. @@ -72,7 +70,9 @@ extern LyXErr lyxerr; } // 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 diff --git a/src/debug.h b/src/debug.h index 24be33ea32..64aa1d207b 100644 --- a/src/debug.h +++ b/src/debug.h @@ -90,9 +90,7 @@ public: 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. @@ -125,7 +123,10 @@ extern LyXErr lyxerr; } // 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 diff --git a/src/frontends/ButtonPolicy.cpp b/src/frontends/ButtonPolicy.cpp index e4b91ff467..98ce944464 100644 --- a/src/frontends/ButtonPolicy.cpp +++ b/src/frontends/ButtonPolicy.cpp @@ -190,10 +190,10 @@ void ButtonPolicy::nextState(SMInput input) 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; diff --git a/src/frontends/qt4/Action.cpp b/src/frontends/qt4/Action.cpp index df0e991c1c..16996b410f 100644 --- a/src/frontends/qt4/Action.cpp +++ b/src/frontends/qt4/Action.cpp @@ -61,8 +61,7 @@ void Action::update() void Action::action() { - // LYXERR(Debug::ACTION) << "calling LyXFunc::dispatch: func_: " - // "\n"; + //LYXERR(Debug::ACTION, "calling LyXFunc::dispatch: func_: "); lyxView_.dispatch(func_); triggered(this); } diff --git a/src/frontends/qt4/ButtonController.cpp b/src/frontends/qt4/ButtonController.cpp index 872ead95b5..68e783691c 100644 --- a/src/frontends/qt4/ButtonController.cpp +++ b/src/frontends/qt4/ButtonController.cpp @@ -81,7 +81,7 @@ void ButtonController::setValid(bool v) 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); @@ -96,7 +96,7 @@ bool ButtonController::setReadOnly(bool ro) void ButtonController::refresh() const { - LYXERR(Debug::GUI) << "Calling BC refresh()" << std::endl; + LYXERR(Debug::GUI, "Calling BC refresh()"); bool const all_valid = checkWidgets(); @@ -118,9 +118,9 @@ void ButtonController::refresh() const 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")); } } diff --git a/src/frontends/qt4/FileDialog.cpp b/src/frontends/qt4/FileDialog.cpp index 569c92e1ca..9fdc890c3e 100644 --- a/src/frontends/qt4/FileDialog.cpp +++ b/src/frontends/qt4/FileDialog.cpp @@ -87,9 +87,9 @@ FileDialog::Result const FileDialog::save(docstring const & path, 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; @@ -115,9 +115,9 @@ FileDialog::Result const FileDialog::save(docstring const & path, 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]))); @@ -131,9 +131,9 @@ FileDialog::Result const FileDialog::open(docstring const & path, 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; @@ -149,9 +149,9 @@ FileDialog::Result const FileDialog::open(docstring const & path, 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]))); @@ -164,8 +164,8 @@ FileDialog::Result const FileDialog::open(docstring const & path, 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; @@ -185,9 +185,9 @@ FileDialog::Result const FileDialog::opendir(docstring const & path, 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]))); diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 0cfd6d104b..86d804898b 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -157,13 +157,11 @@ GuiApplication::GuiApplication(int & argc, char ** argv) 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. @@ -436,7 +434,7 @@ bool GuiApplication::x11EventFilter(XEvent * xev) 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(); @@ -448,7 +446,7 @@ bool GuiApplication::x11EventFilter(XEvent * xev) 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(); diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index 73b8f8f012..975b470d62 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -513,7 +513,7 @@ void GuiCitation::findKey(QString const & str, bool only_keys, // 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. diff --git a/src/frontends/qt4/GuiClipboard.cpp b/src/frontends/qt4/GuiClipboard.cpp index 4d0514fcb0..7798228a21 100644 --- a/src/frontends/qt4/GuiClipboard.cpp +++ b/src/frontends/qt4/GuiClipboard.cpp @@ -47,23 +47,23 @@ GuiClipboard::GuiClipboard() 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(); } @@ -73,8 +73,7 @@ docstring const GuiClipboard::getAsText() const // 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(); @@ -84,8 +83,8 @@ docstring const GuiClipboard::getAsText() const 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; diff --git a/src/frontends/qt4/GuiFontLoader.cpp b/src/frontends/qt4/GuiFontLoader.cpp index c12751f0e1..b6b03be610 100644 --- a/src/frontends/qt4/GuiFontLoader.cpp +++ b/src/frontends/qt4/GuiFontLoader.cpp @@ -29,11 +29,6 @@ #include #include -using lyx::support::contains; -using lyx::support::package; -using lyx::support::addPath; -using lyx::support::addName; - using std::endl; using std::make_pair; @@ -47,6 +42,11 @@ int const num_math_fonts = sizeof(math_fonts) / sizeof(*math_fonts); namespace lyx { +using support::contains; +using support::package; +using support::addPath; +using support::addName; + extern docstring const stateText(FontInfo const & f); namespace frontend { @@ -110,7 +110,7 @@ QString getRawName(QString const & family) 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(); } @@ -127,8 +127,7 @@ QString const symbolFamily(FontFamily family) bool isSymbolFamily(FontFamily family) { - return family >= SYMBOL_FAMILY && - family <= ESINT_FAMILY; + return family >= SYMBOL_FAMILY && family <= ESINT_FAMILY; } @@ -140,10 +139,10 @@ static bool isChosenFont(QFont & font, QString const & 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; } @@ -153,8 +152,8 @@ static bool isChosenFont(QFont & font, QString const & family) static pair 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(); @@ -163,30 +162,30 @@ static pair const getSymbolFont(QString const & family) font.setFamily(family); if (isChosenFont(font, family)) { - LYXERR(Debug::FONT) << "normal!" << endl; + LYXERR(Debug::FONT, "normal!"); return make_pair(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(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(font, true); } - LYXERR(Debug::FONT) << " FAILED :-(" << endl; + LYXERR(Debug::FONT, " FAILED :-("); return make_pair(font, false); } @@ -202,10 +201,9 @@ GuiFontLoader::GuiFontLoader() 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 - (fontID < 0 ? " FAIL" : " OK") - << endl; + (fontID < 0 ? " FAIL" : " OK")); } for (int i1 = 0; i1 < NUM_FAMILIES; ++i1) @@ -298,28 +296,25 @@ GuiFontInfo::GuiFontInfo(FontInfo const & f) 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(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); diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index 824b56843c..5eb0fba11f 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -282,7 +282,7 @@ void GuiGraphics::change_adaptor() void GuiGraphics::change_bb() { bbChanged = true; - LYXERR(Debug::GRAPHICS) << "[bb_Changed set to true]\n"; + LYXERR(Debug::GRAPHICS, "[bb_Changed set to true]"); changed(); } diff --git a/src/frontends/qt4/GuiImage.cpp b/src/frontends/qt4/GuiImage.cpp index efa198bc69..7deeebdf6d 100644 --- a/src/frontends/qt4/GuiImage.cpp +++ b/src/frontends/qt4/GuiImage.cpp @@ -63,28 +63,24 @@ Image::FormatList GuiImage::loadableFormats() 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 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::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); @@ -102,18 +98,16 @@ Image::FormatList GuiImage::loadableFormats() } 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; @@ -148,15 +142,13 @@ unsigned int GuiImage::getHeight_impl() const 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; } diff --git a/src/frontends/qt4/GuiKeySymbol.cpp b/src/frontends/qt4/GuiKeySymbol.cpp index 0670a37198..8a69a44308 100644 --- a/src/frontends/qt4/GuiKeySymbol.cpp +++ b/src/frontends/qt4/GuiKeySymbol.cpp @@ -41,6 +41,7 @@ using lyx::support::contains; using lyx::support::getEnv; +#if 0 static char encode(string const & encoding, QString const & str) { typedef map EncodingMap; @@ -50,46 +51,45 @@ static char encode(string const & encoding, QString const & str) 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())); } @@ -97,15 +97,14 @@ void KeySymbol::init(string const & symbolname) { 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; } @@ -113,7 +112,7 @@ bool KeySymbol::isOK() const 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; } @@ -140,11 +139,9 @@ char_type KeySymbol::getUCSEncoded() const 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]; @@ -173,7 +170,7 @@ bool KeySymbol::isText() const { if (!text_.empty()) return true; - LYXERR(Debug::KEY) << "text_ empty, isText() == false" << endl; + LYXERR(Debug::KEY, "text_ empty, isText() == false"); return false; } diff --git a/src/frontends/qt4/GuiMenubar.cpp b/src/frontends/qt4/GuiMenubar.cpp index 83d53e060a..194095ddff 100644 --- a/src/frontends/qt4/GuiMenubar.cpp +++ b/src/frontends/qt4/GuiMenubar.cpp @@ -42,17 +42,17 @@ GuiMenubar::GuiMenubar(LyXView * view, MenuBackend & mbe) { 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; @@ -64,18 +64,17 @@ GuiMenubar::GuiMenubar(LyXView * view, MenuBackend & mbe) 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; } diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index 59b613dc46..e5dd0c4696 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -372,8 +372,8 @@ int GuiPainter::text(int x, int y, docstring const & s, // 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; } @@ -405,9 +405,9 @@ int GuiPainter::text(int x, int y, docstring const & s, 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); diff --git a/src/frontends/qt4/GuiPopupMenu.cpp b/src/frontends/qt4/GuiPopupMenu.cpp index 16c5368fa9..b59af470e3 100644 --- a/src/frontends/qt4/GuiPopupMenu.cpp +++ b/src/frontends/qt4/GuiPopupMenu.cpp @@ -48,8 +48,8 @@ GuiPopupMenu::GuiPopupMenu(GuiMenubar * owner, MenuItem const & mi, 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(); @@ -63,8 +63,8 @@ void GuiPopupMenu::updateView() 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_); } @@ -72,13 +72,12 @@ void GuiPopupMenu::updateView() 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(); @@ -88,19 +87,19 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu) 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); diff --git a/src/frontends/qt4/GuiSelection.cpp b/src/frontends/qt4/GuiSelection.cpp index 1e11f93f8c..241d9422b9 100644 --- a/src/frontends/qt4/GuiSelection.cpp +++ b/src/frontends/qt4/GuiSelection.cpp @@ -73,8 +73,7 @@ docstring const GuiSelection::get() const { 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(); @@ -84,7 +83,7 @@ docstring const GuiSelection::get() const 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); diff --git a/src/frontends/qt4/GuiSpellchecker.cpp b/src/frontends/qt4/GuiSpellchecker.cpp index 030b86d830..c223bf095e 100644 --- a/src/frontends/qt4/GuiSpellchecker.cpp +++ b/src/frontends/qt4/GuiSpellchecker.cpp @@ -246,7 +246,7 @@ static SpellBase * getSpeller(BufferParams const & bp) bool GuiSpellchecker::initialiseParams(std::string const &) { - LYXERR(Debug::GUI) << "Spellchecker::initialiseParams" << endl; + LYXERR(Debug::GUI, "Spellchecker::initialiseParams"); speller_ = getSpeller(buffer().params()); if (!speller_) @@ -273,7 +273,7 @@ bool GuiSpellchecker::initialiseParams(std::string const &) void GuiSpellchecker::clearParams() { - LYXERR(Debug::GUI) << "Spellchecker::clearParams" << endl; + LYXERR(Debug::GUI, "Spellchecker::clearParams"); delete speller_; speller_ = 0; } @@ -337,7 +337,7 @@ static WordLangTuple nextWord(Cursor & cur, ptrdiff_t & progress) 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; @@ -372,7 +372,7 @@ void GuiSpellchecker::check() 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); @@ -389,7 +389,7 @@ void GuiSpellchecker::check() 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; @@ -401,7 +401,7 @@ void GuiSpellchecker::check() // 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); } } @@ -446,8 +446,8 @@ void GuiSpellchecker::showSummary() 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 diff --git a/src/frontends/qt4/GuiToc.cpp b/src/frontends/qt4/GuiToc.cpp index 760e7d07d8..27ac5d0601 100644 --- a/src/frontends/qt4/GuiToc.cpp +++ b/src/frontends/qt4/GuiToc.cpp @@ -71,14 +71,12 @@ QStandardItemModel * GuiToc::tocModel(int type) 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]; @@ -104,9 +102,7 @@ void GuiToc::goTo(int type, QModelIndex const & index) { 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; } @@ -114,7 +110,7 @@ void GuiToc::goTo(int type, QModelIndex const & index) 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(it->id()); lyxview().dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp)); diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 23715a0a3a..a7e1301a64 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -161,9 +161,8 @@ string const find_png(string const & name) 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; } @@ -218,9 +217,9 @@ static QIcon getIcon(FuncRequest const & f, bool unknown) 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"); diff --git a/src/frontends/qt4/GuiToolbars.cpp b/src/frontends/qt4/GuiToolbars.cpp index e3ab5e8a89..e5999ef2d9 100644 --- a/src/frontends/qt4/GuiToolbars.cpp +++ b/src/frontends/qt4/GuiToolbars.cpp @@ -131,8 +131,8 @@ void GuiToolbars::init() 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 @@ -174,8 +174,7 @@ void GuiToolbars::display(string const & name, bool show) } } - LYXERR(Debug::GUI) << "Toolbar::display: no toolbar named " - << name << endl; + LYXERR(Debug::GUI, "Toolbar::display: no toolbar named " << name); } @@ -190,8 +189,7 @@ void GuiToolbars::toggleToolbarState(string const & name, bool allowauto) 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; } diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 1c30baf32b..4a4d563911 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -210,7 +210,7 @@ struct GuiView::GuiViewPrivate 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); @@ -302,7 +302,7 @@ GuiView::GuiView(int id) 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_); @@ -446,8 +446,7 @@ void GuiView::dropEvent(QDropEvent* event) 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())); @@ -977,7 +976,7 @@ void GuiView::updateEmbeddedFiles() void GuiView::autoSave() { - LYXERR(Debug::INFO) << "Running autoSave()" << endl; + LYXERR(Debug::INFO, "Running autoSave()"); if (buffer()) view()->buffer().autoSave(); diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 19e7661952..66654b45ba 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -247,10 +247,9 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & lv) // 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. @@ -323,7 +322,7 @@ void GuiWorkArea::redraw() 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(); @@ -331,9 +330,8 @@ void GuiWorkArea::redraw() 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(); @@ -670,20 +668,18 @@ void GuiWorkArea::keyPressEvent(QKeyEvent * ev) #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); @@ -791,10 +787,9 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e) 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; @@ -1107,8 +1102,8 @@ void TabWorkArea::on_currentTabChanged(int i) /// currentWorkAreaChanged(wa); - LYXERR(Debug::GUI) << "currentTabChanged " << i - << "File" << bv.buffer().absFileName() << endl; + LYXERR(Debug::GUI, "currentTabChanged " << i + << "File" << bv.buffer().absFileName()); } diff --git a/src/frontends/qt4/PanelStack.cpp b/src/frontends/qt4/PanelStack.cpp index 79f7895059..a8974fcf73 100644 --- a/src/frontends/qt4/PanelStack.cpp +++ b/src/frontends/qt4/PanelStack.cpp @@ -62,7 +62,7 @@ void PanelStack::addCategory(docstring const & n, docstring const & parent) 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; diff --git a/src/frontends/qt4/TocModel.cpp b/src/frontends/qt4/TocModel.cpp index d9adf4dcee..adc580bc99 100644 --- a/src/frontends/qt4/TocModel.cpp +++ b/src/frontends/qt4/TocModel.cpp @@ -100,10 +100,8 @@ void TocModel::populate(Toc const & toc) 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); diff --git a/src/frontends/qt4/TocWidget.cpp b/src/frontends/qt4/TocWidget.cpp index 7fef1afd35..ec1fa42eec 100644 --- a/src/frontends/qt4/TocWidget.cpp +++ b/src/frontends/qt4/TocWidget.cpp @@ -64,10 +64,8 @@ TocWidget::TocWidget(GuiToc & form, QWidget * parent) 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); } @@ -185,8 +183,7 @@ void TocWidget::on_moveOutTB_clicked() 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; } @@ -215,7 +212,7 @@ void TocWidget::enableControls(bool enable) void TocWidget::updateView() { - LYXERR(Debug::GUI) << "In TocWidget::updateView()" << endl; + LYXERR(Debug::GUI, "In TocWidget::updateView()"); select(form_.currentIndex(typeCO->currentIndex())); } @@ -271,17 +268,15 @@ void TocWidget::setTocModel(size_t type) 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()); } } diff --git a/src/graphics/GraphicsCache.cpp b/src/graphics/GraphicsCache.cpp index 10f9fc7a73..43743535f2 100644 --- a/src/graphics/GraphicsCache.cpp +++ b/src/graphics/GraphicsCache.cpp @@ -69,9 +69,8 @@ void Cache::add(FileName const & file) const { // 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; } diff --git a/src/graphics/GraphicsCacheItem.cpp b/src/graphics/GraphicsCacheItem.cpp index 5dc3cbe7cb..7b206986e2 100644 --- a/src/graphics/GraphicsCacheItem.cpp +++ b/src/graphics/GraphicsCacheItem.cpp @@ -260,7 +260,7 @@ void CacheItem::Impl::setStatus(ImageStatus new_status) 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(); @@ -270,8 +270,7 @@ void CacheItem::Impl::imageConverted(bool success) 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_) @@ -292,7 +291,7 @@ void CacheItem::Impl::imageConverted(bool success) void CacheItem::Impl::loadImage() { setStatus(Loading); - LYXERR(Debug::GRAPHICS) << "Loading image." << endl; + LYXERR(Debug::GRAPHICS, "Loading image."); image_ = Image::newImage(); @@ -306,7 +305,7 @@ void CacheItem::Impl::loadImage() 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_) @@ -354,9 +353,8 @@ static string const findTargetFormat(string const & from) 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 @@ -373,8 +371,7 @@ void CacheItem::Impl::convertToDisplayFormat() 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; } @@ -386,8 +383,7 @@ void CacheItem::Impl::convertToDisplayFormat() 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()); @@ -396,38 +392,34 @@ void CacheItem::Impl::convertToDisplayFormat() } 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. diff --git a/src/graphics/GraphicsConverter.cpp b/src/graphics/GraphicsConverter.cpp index 67e0421663..aace6d2b13 100644 --- a/src/graphics/GraphicsConverter.cpp +++ b/src/graphics/GraphicsConverter.cpp @@ -137,11 +137,11 @@ Converter::Impl::Impl(FileName const & from_file, string const & to_file_base, 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 @@ -151,10 +151,10 @@ Converter::Impl::Impl(FileName const & from_file, string const & to_file_base, // 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; @@ -197,9 +197,9 @@ void Converter::Impl::startConversion() 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_) @@ -277,7 +277,7 @@ static void build_script(FileName const & from_file, 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" @@ -356,18 +356,18 @@ static void build_script(FileName const & from_file, << 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(); @@ -401,9 +401,8 @@ static void build_script(FileName const & from_file, // 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 diff --git a/src/graphics/GraphicsImage.cpp b/src/graphics/GraphicsImage.cpp index c713040824..ccb96206e3 100644 --- a/src/graphics/GraphicsImage.cpp +++ b/src/graphics/GraphicsImage.cpp @@ -42,12 +42,10 @@ Image::getScaledDimensions(Params const & params) const 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); } diff --git a/src/graphics/LoaderQueue.cpp b/src/graphics/LoaderQueue.cpp index 6038dbe4b9..977d0c6955 100644 --- a/src/graphics/LoaderQueue.cpp +++ b/src/graphics/LoaderQueue.cpp @@ -36,9 +36,8 @@ LoaderQueue & LoaderQueue::get() 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(); @@ -59,10 +58,9 @@ void LoaderQueue::setPriority(int numimages , int millisecs) { 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"); } @@ -75,7 +73,7 @@ LoaderQueue::LoaderQueue() : timer(s_millisecs_, Timeout::ONETIME), void LoaderQueue::startLoader() { - LYXERR(Debug::GRAPHICS) << "LoaderQueue: waking up" << endl; + LYXERR(Debug::GRAPHICS, "LoaderQueue: waking up"); running_ = true ; timer.setTimeout(s_millisecs_); timer.start(); @@ -86,7 +84,7 @@ void LoaderQueue::stopLoader() { timer.stop(); running_ = false ; - LYXERR(Debug::GRAPHICS) << "LoaderQueue: I'm going to sleep" << endl; + LYXERR(Debug::GRAPHICS, "LoaderQueue: I'm going to sleep"); } diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 0c66048806..c81760bd85 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -414,8 +414,8 @@ PreviewLoader::Impl::Impl(PreviewLoader & p, Buffer const & b) font_scaling_factor_ = 0.01 * lyxrc.dpi * lyxrc.zoom * convert(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(); @@ -494,7 +494,7 @@ void PreviewLoader::Impl::add(string const & latex_snippet) if (snippet.empty()) return; - LYXERR(Debug::GRAPHICS) << "adding snippet:\n" << snippet << endl; + LYXERR(Debug::GRAPHICS, "adding snippet:\n" << snippet); pending_.push_back(snippet); } @@ -556,7 +556,7 @@ void PreviewLoader::Impl::startLoading() 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(); @@ -584,9 +584,8 @@ void PreviewLoader::Impl::startLoading() 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"; @@ -598,9 +597,8 @@ void PreviewLoader::Impl::startLoading() 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; } @@ -623,9 +621,8 @@ void PreviewLoader::Impl::startLoading() 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; } @@ -648,9 +645,9 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval) 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; diff --git a/src/insets/ExternalSupport.cpp b/src/insets/ExternalSupport.cpp index 22d3227737..41a8f8e087 100644 --- a/src/insets/ExternalSupport.cpp +++ b/src/insets/ExternalSupport.cpp @@ -262,10 +262,8 @@ void updateExternal(InsetExternalParams const & params, 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 } } @@ -323,10 +321,8 @@ void updateExternal(InsetExternalParams const & params, 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 @@ -356,10 +352,8 @@ int writeExternal(InsetExternalParams const & params, 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; } diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 10a2e04ebc..5f0754b8e6 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -203,16 +203,13 @@ bool Inset::getStatus(Cursor &, FuncRequest const & cmd, 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; } diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 04124e1bb2..31145541d7 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -346,7 +346,7 @@ vector const InsetBibtex::getFiles(Buffer const & buffer) const 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()) diff --git a/src/insets/InsetFloatList.cpp b/src/insets/InsetFloatList.cpp index 64336f6660..44599dda9b 100644 --- a/src/insets/InsetFloatList.cpp +++ b/src/insets/InsetFloatList.cpp @@ -90,12 +90,14 @@ void InsetFloatList::read(Buffer const & buf, Lexer & lex) 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(); diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 7d1ea0bd4d..1ad3118583 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -126,7 +126,7 @@ string findTargetFormat(string const & format, OutputParams const & runparams) { // 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()) @@ -138,7 +138,7 @@ string findTargetFormat(string const & format, OutputParams const & runparams) 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"; @@ -244,10 +244,9 @@ void InsetGraphics::updateEmbeddedFile(Buffer const & buf, { 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()); } @@ -289,7 +288,7 @@ void InsetGraphics::read(Buffer const & buf, Lexer & lex) 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() @@ -313,12 +312,12 @@ void InsetGraphics::readInsetGraphics(Lexer & lex, string const & bufpath) 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)) @@ -507,11 +506,10 @@ copyFileIfNeeded(FileName const & file_in, FileName const & file_out) 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; @@ -655,8 +653,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf, // 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) { @@ -692,33 +689,27 @@ string const InsetGraphics::prepareFile(Buffer const & buf, // 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) { @@ -730,11 +721,10 @@ string const InsetGraphics::prepareFile(Buffer const & buf, 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, @@ -751,10 +741,9 @@ string const InsetGraphics::prepareFile(Buffer const & buf, // 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, @@ -762,11 +751,10 @@ string const InsetGraphics::prepareFile(Buffer const & buf, 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; @@ -788,9 +776,8 @@ int InsetGraphics::latex(Buffer const & buf, odocstream & os, { // 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()); @@ -803,8 +790,7 @@ int InsetGraphics::latex(Buffer const & buf, odocstream & os, // "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. @@ -826,16 +812,14 @@ int InsetGraphics::latex(Buffer const & buf, odocstream & os, // 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. @@ -846,8 +830,7 @@ int InsetGraphics::latex(Buffer const & buf, odocstream & os, // 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')); } @@ -872,39 +855,32 @@ int InsetGraphics::plaintext(Buffer const & buf, odocstream & os, } -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 << "" ; - } - else { - os << " format=\"" << format << "\">" ; - } - os << ""; - if (runparams.flavor != OutputParams::XML) { - os << std::endl << "]]>" ; - } - return runparams.flavor == OutputParams::XML ? 0 : 2; -} -// end anonymous namespace + if (runparams.flavor != OutputParams::XML) + os << "" ; + else + os << " format=\"" << format << "\">" ; + + os << ""; + + if (runparams.flavor != OutputParams::XML) + os << std::endl << "]]>" ; + + return runparams.flavor == OutputParams::XML ? 0 : 2; } @@ -917,13 +893,13 @@ int InsetGraphics::docbook(Buffer const &, odocstream & os, // 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 << ""; int r = 0; diff --git a/src/insets/InsetGraphicsParams.cpp b/src/insets/InsetGraphicsParams.cpp index c9a01e5ca4..596f738503 100644 --- a/src/insets/InsetGraphicsParams.cpp +++ b/src/insets/InsetGraphicsParams.cpp @@ -287,7 +287,7 @@ graphics::Params InsetGraphicsParams::as_grfxParams() const // 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(token(tmp, ' ', 0)); diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index a6933444a5..ecab91e252 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -75,7 +75,6 @@ using support::prefixIs; using support::subst; using support::sum; -using std::endl; using std::find; using std::string; using std::istringstream; @@ -397,9 +396,9 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os, "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 @@ -470,11 +469,10 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os, 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; } } @@ -583,9 +581,9 @@ int InsetInclude::docbook(Buffer const & buffer, odocstream & os, 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); } diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 7924c3d86c..9bdff84468 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -2824,8 +2824,8 @@ Tabular::getCellFromInset(Inset const * inset) const 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; } @@ -3207,8 +3207,8 @@ void InsetTabular::updateLabels(Buffer const & buf, ParIterator const & it) 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(); diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 1dc5b5b2ad..c43a57e3f0 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -226,9 +226,8 @@ Inset * InsetText::editXY(Cursor & cur, int x, int y) 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); } diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index ce637a72d8..f357c2e43c 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -227,10 +227,8 @@ void InsetMathGrid::halign(docstring const & hh) 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(); @@ -246,10 +244,8 @@ void InsetMathGrid::halign(docstring const & hh) 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; diff --git a/src/mathed/InsetMathScript.cpp b/src/mathed/InsetMathScript.cpp index b91fbf6401..c09cb4e22e 100644 --- a/src/mathed/InsetMathScript.cpp +++ b/src/mathed/InsetMathScript.cpp @@ -535,8 +535,7 @@ void InsetMathScript::write(WriteStream & os) const //} } else { if (os.firstitem()) - LYXERR(Debug::MATHED) << "suppressing {} when writing" - << endl; + LYXERR(Debug::MATHED, "suppressing {} when writing"); else os << "{}"; } diff --git a/src/mathed/MathAutoCorrect.cpp b/src/mathed/MathAutoCorrect.cpp index 2f8f1e8124..caa81cff9b 100644 --- a/src/mathed/MathAutoCorrect.cpp +++ b/src/mathed/MathAutoCorrect.cpp @@ -84,15 +84,14 @@ void Correction::write(odocstream & os) const 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; } @@ -143,7 +142,7 @@ Corrections theCorrections; 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; @@ -154,20 +153,20 @@ void initAutoCorrect() 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."); } diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp index 005805f4ca..923a5dc1c2 100644 --- a/src/mathed/MathFactory.cpp +++ b/src/mathed/MathFactory.cpp @@ -94,9 +94,8 @@ bool math_font_available(docstring & name) 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; } @@ -104,7 +103,7 @@ bool math_font_available(docstring & name) 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; @@ -158,9 +157,9 @@ void initSymbols() 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; } @@ -180,44 +179,40 @@ void initSymbols() 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"); diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 0e1e2ee5b9..085a6f1ccd 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -70,7 +70,7 @@ TeXDeeper(Buffer const & buf, 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() && @@ -83,7 +83,7 @@ TeXDeeper(Buffer const & buf, os, texrow, runparams); } } - LYXERR(Debug::LATEX) << "TeXDeeper...done " << endl; + LYXERR(Debug::LATEX, "TeXDeeper...done "); return par; } @@ -96,7 +96,7 @@ TeXEnvironment(Buffer const & buf, odocstream & os, TexRow & texrow, OutputParams const & runparams) { - LYXERR(Debug::LATEX) << "TeXEnvironment... " << &*pit << endl; + LYXERR(Debug::LATEX, "TeXEnvironment... " << &*pit); BufferParams const & bparams = buf.params(); @@ -211,9 +211,9 @@ TeXEnvironment(Buffer const & buf, 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; } @@ -249,8 +249,8 @@ TeXOnePar(Buffer const & buf, 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; @@ -606,9 +606,8 @@ TeXOnePar(Buffer const & buf, 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; } @@ -734,14 +733,13 @@ pair switchEncoding(odocstream & os, BufferParams const & bparams, || 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 @@ -754,7 +752,7 @@ pair switchEncoding(odocstream & os, BufferParams const & bparams, } os << "\\inputencoding{" << inputenc << '}'; return make_pair(true, count + 16); - } + } case Encoding::CJK: { int count = inputenc.length(); if (oldEnc.package() == Encoding::CJK) { diff --git a/src/output_plaintext.cpp b/src/output_plaintext.cpp index 7f37f8d70c..d12c82b85c 100644 --- a/src/output_plaintext.cpp +++ b/src/output_plaintext.cpp @@ -223,8 +223,7 @@ void writePlaintextParagraph(Buffer const & buf, break; case '\0': - LYXERR(Debug::INFO) << - "writePlaintextFile: NULL char in structure." << endl; + LYXERR(Debug::INFO, "writePlaintextFile: NULL char in structure."); break; default: diff --git a/src/paragraph_funcs.cpp b/src/paragraph_funcs.cpp index 410d4abc5b..46d4c17a01 100644 --- a/src/paragraph_funcs.cpp +++ b/src/paragraph_funcs.cpp @@ -196,8 +196,8 @@ void mergeParagraph(BufferParams const & bparams, // 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)); } diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index 5c31ee8373..adf25ec5d3 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -252,7 +252,7 @@ bool FileName::isWritable() const bool FileName::isDirWritable() const { - LYXERR(Debug::FILES) << "isDirWriteable: " << *this << std::endl; + LYXERR(Debug::FILES, "isDirWriteable: " << *this); FileName const tmpfl(tempName(*this, "lyxwritetest")); @@ -374,10 +374,8 @@ string FileName::guessFormatFromContents() const 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; } @@ -485,14 +483,12 @@ string FileName::guessFormatFromContents() const } 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(); } diff --git a/src/support/ForkedCallQueue.cpp b/src/support/ForkedCallQueue.cpp index d9cd657d4f..148dba9acd 100644 --- a/src/support/ForkedCallQueue.cpp +++ b/src/support/ForkedCallQueue.cpp @@ -63,20 +63,21 @@ void ForkedCallQueue::callNext() 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(); } @@ -85,8 +86,7 @@ void ForkedCallQueue::startCaller() void ForkedCallQueue::stopCaller() { running_ = false ; - LYXERR(Debug::GRAPHICS) << "ForkedCallQueue: I'm going to sleep" - << endl; + LYXERR(Debug::GRAPHICS, "ForkedCallQueue: I'm going to sleep"); } diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 7901119a6f..7a35d0cb91 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -198,9 +198,8 @@ vector const dirList(FileName const & dir, string const & ext) vector 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; } @@ -354,9 +353,8 @@ string const libScriptSearch(string const & command_in, quote_style style) 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 @@ -890,9 +888,8 @@ FileName const findtexfile(string const & fil, string const & /*format*/) 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"))); @@ -916,8 +913,7 @@ void removeAutosaveFile(string const & filename) 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); diff --git a/src/support/lyxsum.cpp b/src/support/lyxsum.cpp index 8a57f4e479..e1be53ee93 100644 --- a/src/support/lyxsum.cpp +++ b/src/support/lyxsum.cpp @@ -53,8 +53,7 @@ namespace support { 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) @@ -116,8 +115,7 @@ using std::istreambuf_iterator; 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()) @@ -139,9 +137,7 @@ using std::ios; 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()) diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index 357f3c1e40..450b998346 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -191,10 +191,8 @@ string latex_path(string const & p) if (windows_style_tex_paths_ && is_absolute_path(p)) { string dos_path = convert_path(p, PathStyle(windows)); - LYXERR(Debug::LATEX) - << " [" - << p << "]->>[" - << dos_path << ']' << endl; + LYXERR(Debug::LATEX, " [" + << p << "]->>[" << dos_path << ']'); return dos_path; } diff --git a/src/support/os_win32.cpp b/src/support/os_win32.cpp index cae4849801..a4f98e07c3 100644 --- a/src/support/os_win32.cpp +++ b/src/support/os_win32.cpp @@ -193,10 +193,8 @@ string external_path(string const & p) { string const dos_path = subst(p, "/", "\\"); - LYXERR(Debug::LATEX) - << " [" - << p << "]->>[" - << dos_path << ']' << endl; + LYXERR(Debug::LATEX, " [" + << p << "]->>[" << dos_path << ']'); return dos_path; } @@ -249,10 +247,8 @@ string latex_path(string const & p) 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) - << " [" - << p << "]->>[" - << cygpath << ']' << endl; + LYXERR(Debug::LATEX, << " [" + << p << "]->>[" << cygpath << ']'); return cygpath; } return subst(p, '\\', '/'); diff --git a/src/support/tempname.cpp b/src/support/tempname.cpp index 049b863d7e..6c6e998210 100644 --- a/src/support/tempname.cpp +++ b/src/support/tempname.cpp @@ -112,15 +112,11 @@ FileName const tempName(FileName const & dir, string const & mask) #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