assimilate BOOST_CURRENT_FUNCTION

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21867 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-11-29 21:10:35 +00:00
parent cc245f3d6d
commit 2506e0d643
16 changed files with 93 additions and 143 deletions

View File

@ -75,8 +75,6 @@
#include "support/Package.h" #include "support/Package.h"
#include "support/types.h" #include "support/types.h"
#include <boost/current_function.hpp>
#include <cerrno> #include <cerrno>
#include <fstream> #include <fstream>
#include <functional> #include <functional>
@ -449,8 +447,8 @@ void BufferView::updateScrollbar()
d->offset_ref_ = 0; d->offset_ref_ = 0;
} }
LYXERR(Debug::GUI, BOOST_CURRENT_FUNCTION LYXERR(Debug::GUI, " Updating scrollbar: height: "
<< " Updating scrollbar: height: " << t.paragraphs().size() << t.paragraphs().size()
<< " curr par: " << d->cursor_.bottom().pit() << " curr par: " << d->cursor_.bottom().pit()
<< " default height " << defaultRowHeight()); << " default height " << defaultRowHeight());
@ -501,7 +499,7 @@ ScrollbarParameters const & BufferView::scrollbarParameters() const
void BufferView::scrollDocView(int value) void BufferView::scrollDocView(int value)
{ {
LYXERR(Debug::GUI, BOOST_CURRENT_FUNCTION << "[ value = " << value << "]"); LYXERR(Debug::GUI, "[ value = " << value << "]");
Text & t = buffer_.text(); Text & t = buffer_.text();
TextMetrics & tm = d->text_metrics_[&t]; TextMetrics & tm = d->text_metrics_[&t];

View File

@ -28,7 +28,6 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/crc.hpp> #include <boost/crc.hpp>
#include <boost/current_function.hpp>
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
@ -258,7 +257,7 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format,
if (!lyxrc.use_converter_cache || orig_from.empty() || if (!lyxrc.use_converter_cache || orig_from.empty() ||
converted_file.empty()) converted_file.empty())
return; return;
LYXERR(Debug::FILES, BOOST_CURRENT_FUNCTION << ' ' << orig_from LYXERR(Debug::FILES, ' ' << orig_from
<< ' ' << to_format << ' ' << converted_file); << ' ' << to_format << ' ' << converted_file);
// FIXME: Should not hardcode this (see bug 3819 for details) // FIXME: Should not hardcode this (see bug 3819 for details)
@ -318,8 +317,7 @@ void ConverterCache::remove(FileName const & orig_from,
{ {
if (!lyxrc.use_converter_cache || orig_from.empty()) if (!lyxrc.use_converter_cache || orig_from.empty())
return; return;
LYXERR(Debug::FILES, BOOST_CURRENT_FUNCTION << ' ' << orig_from LYXERR(Debug::FILES, orig_from << ' ' << to_format);
<< ' ' << to_format);
CacheType::iterator const it1 = pimpl_->cache.find(orig_from); CacheType::iterator const it1 = pimpl_->cache.find(orig_from);
if (it1 == pimpl_->cache.end()) if (it1 == pimpl_->cache.end())
@ -379,8 +377,7 @@ bool ConverterCache::inCache(FileName const & orig_from,
{ {
if (!lyxrc.use_converter_cache || orig_from.empty()) if (!lyxrc.use_converter_cache || orig_from.empty())
return false; return false;
LYXERR(Debug::FILES, BOOST_CURRENT_FUNCTION << ' ' << orig_from LYXERR(Debug::FILES, orig_from << ' ' << to_format);
<< ' ' << to_format);
CacheItem * const item = pimpl_->find(orig_from, to_format); CacheItem * const item = pimpl_->find(orig_from, to_format);
if (!item) { if (!item) {
@ -405,8 +402,7 @@ bool ConverterCache::inCache(FileName const & orig_from,
FileName const & ConverterCache::cacheName(FileName const & orig_from, FileName const & ConverterCache::cacheName(FileName const & orig_from,
string const & to_format) const string const & to_format) const
{ {
LYXERR(Debug::FILES, BOOST_CURRENT_FUNCTION << ' ' << orig_from LYXERR(Debug::FILES, orig_from << ' ' << to_format);
<< ' ' << to_format);
CacheItem * const item = pimpl_->find(orig_from, to_format); CacheItem * const item = pimpl_->find(orig_from, to_format);
BOOST_ASSERT(item); BOOST_ASSERT(item);
@ -419,8 +415,7 @@ bool ConverterCache::copy(FileName const & orig_from, string const & to_format,
{ {
if (!lyxrc.use_converter_cache || orig_from.empty() || dest.empty()) if (!lyxrc.use_converter_cache || orig_from.empty() || dest.empty())
return false; return false;
LYXERR(Debug::FILES, BOOST_CURRENT_FUNCTION << ' ' << orig_from LYXERR(Debug::FILES, orig_from << ' ' << to_format << ' ' << dest);
<< ' ' << to_format << ' ' << dest);
// FIXME: Should not hardcode this (see bug 3819 for details) // FIXME: Should not hardcode this (see bug 3819 for details)
if (to_format == "pstex") { if (to_format == "pstex") {

View File

@ -48,7 +48,6 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/current_function.hpp>
#include <sstream> #include <sstream>
#include <limits> #include <limits>
@ -293,8 +292,7 @@ void Cursor::setCursor(DocIterator const & cur)
void Cursor::dispatch(FuncRequest const & cmd0) void Cursor::dispatch(FuncRequest const & cmd0)
{ {
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "cmd: " << cmd0 << '\n' << *this);
<< " cmd: " << cmd0 << '\n' << *this);
if (empty()) if (empty())
return; return;
@ -1301,7 +1299,7 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
void Cursor::handleFont(string const & font) void Cursor::handleFont(string const & font)
{ {
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << ": " << font); LYXERR(Debug::DEBUG, font);
docstring safe; docstring safe;
if (selection()) { if (selection()) {
macroModeClose(); macroModeClose();

View File

@ -53,7 +53,6 @@
#include "frontends/Clipboard.h" #include "frontends/Clipboard.h"
#include "frontends/Selection.h" #include "frontends/Selection.h"
#include <boost/current_function.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/next_prior.hpp> #include <boost/next_prior.hpp>
@ -658,8 +657,9 @@ void copySelection(Cursor & cur, docstring const & plaintext)
par.insert(0, plaintext, Font(), Change(Change::UNCHANGED)); par.insert(0, plaintext, Font(), Change(Change::UNCHANGED));
pars.push_back(par); pars.push_back(par);
theCuts.push(make_pair(pars, bp.getTextClassPtr())); theCuts.push(make_pair(pars, bp.getTextClassPtr()));
} else } else {
copySelectionToStack(cur, theCuts); copySelectionToStack(cur, theCuts);
}
// stuff the selection onto the X clipboard, from an explicit copy request // stuff the selection onto the X clipboard, from an explicit copy request
putClipboard(theCuts[0].first, theCuts[0].second, plaintext); putClipboard(theCuts[0].first, theCuts[0].second, plaintext);
@ -674,8 +674,7 @@ void saveSelection(Cursor & cur)
if (cur.selection() if (cur.selection()
&& cur.selBegin() == cur.bv().cursor().selBegin() && cur.selBegin() == cur.bv().cursor().selBegin()
&& cur.selEnd() == cur.bv().cursor().selEnd()) { && cur.selEnd() == cur.bv().cursor().selEnd()) {
LYXERR(Debug::ACTION, BOOST_CURRENT_FUNCTION << ": `" LYXERR(Debug::ACTION, "'" << cur.selectionAsString(true) << "'");
<< to_utf8(cur.selectionAsString(true)) << "'.");
copySelectionToStack(cur, selectionBuffer); copySelectionToStack(cur, selectionBuffer);
} }
} }

View File

@ -93,8 +93,6 @@
#include "support/convert.h" #include "support/convert.h"
#include "support/os.h" #include "support/os.h"
#include <boost/current_function.hpp>
#include <sstream> #include <sstream>
using std::endl; using std::endl;
@ -412,8 +410,7 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
cancel_meta_seq.reset(); cancel_meta_seq.reset();
FuncRequest func = cancel_meta_seq.addkey(keysym, state); FuncRequest func = cancel_meta_seq.addkey(keysym, state);
LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION LYXERR(Debug::KEY, "action first set to [" << func.action << ']');
<< " action first set to [" << func.action << ']');
// When not cancel or meta-fake, do the normal lookup. // When not cancel or meta-fake, do the normal lookup.
// Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards. // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
@ -421,8 +418,7 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
if ((func.action != LFUN_CANCEL) && (func.action != LFUN_META_PREFIX)) { if ((func.action != LFUN_CANCEL) && (func.action != LFUN_META_PREFIX)) {
// remove Caps Lock and Mod2 as a modifiers // remove Caps Lock and Mod2 as a modifiers
func = keyseq.addkey(keysym, (state | meta_fake_bit)); func = keyseq.addkey(keysym, (state | meta_fake_bit));
LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION LYXERR(Debug::KEY, "action now set to [" << func.action << ']');
<< "action now set to [" << func.action << ']');
} }
// Dont remove this unless you know what you are doing. // Dont remove this unless you know what you are doing.
@ -432,9 +428,8 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
if (func.action == LFUN_NOACTION) if (func.action == LFUN_NOACTION)
func = FuncRequest(LFUN_COMMAND_PREFIX); func = FuncRequest(LFUN_COMMAND_PREFIX);
LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION LYXERR(Debug::KEY, " Key [action=" << func.action << "]["
<< " Key [action=" << func.action << "][" << keyseq.print(KeySequence::Portable) << ']');
<< to_utf8(keyseq.print(KeySequence::Portable)) << ']');
// already here we know if it any point in going further // already here we know if it any point in going further
// why not return already here if action == -1 and // why not return already here if action == -1 and

View File

@ -1,5 +1,5 @@
/** /**
* \file src/text.cpp * \file src/Text.cpp
* This file is part of LyX, the document processor. * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
@ -29,14 +29,12 @@
#include "Cursor.h" #include "Cursor.h"
#include "ParIterator.h" #include "ParIterator.h"
#include "CutAndPaste.h" #include "CutAndPaste.h"
#include "support/debug.h"
#include "DispatchResult.h" #include "DispatchResult.h"
#include "Encoding.h" #include "Encoding.h"
#include "ErrorList.h" #include "ErrorList.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "factory.h" #include "factory.h"
#include "FontIterator.h" #include "FontIterator.h"
#include "support/gettext.h"
#include "Language.h" #include "Language.h"
#include "Length.h" #include "Length.h"
#include "Lexer.h" #include "Lexer.h"
@ -64,22 +62,18 @@
#include "insets/InsetSpecialChar.h" #include "insets/InsetSpecialChar.h"
#include "insets/InsetTabular.h" #include "insets/InsetTabular.h"
#include "support/convert.h"
#include "support/debug.h"
#include "support/docstream.h" #include "support/docstream.h"
#include "support/gettext.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/textutils.h" #include "support/textutils.h"
#include "support/convert.h"
#include <boost/current_function.hpp>
#include <boost/next_prior.hpp> #include <boost/next_prior.hpp>
#include <sstream> #include <sstream>
using std::auto_ptr; using std::auto_ptr;
using std::advance;
using std::distance;
using std::max;
using std::min;
using std::endl;
using std::string; using std::string;
namespace lyx { namespace lyx {
@ -137,15 +131,11 @@ void readParToken(Buffer const & buf, Paragraph & par, Lexer & lex,
par.params().read(lex); par.params().read(lex);
} else if (token == "\\end_layout") { } else if (token == "\\end_layout") {
lyxerr << BOOST_CURRENT_FUNCTION LYXERR0("Solitary \\end_layout in line " << lex.getLineNo() << "\n"
<< ": Solitary \\end_layout in line " << "Missing \\begin_layout ?");
<< lex.getLineNo() << "\n"
<< "Missing \\begin_layout?.\n";
} else if (token == "\\end_inset") { } else if (token == "\\end_inset") {
lyxerr << BOOST_CURRENT_FUNCTION LYXERR0("Solitary \\end_inset in line " << lex.getLineNo() << "\n"
<< ": Solitary \\end_inset in line " << "Missing \\begin_inset ?");
<< lex.getLineNo() << "\n"
<< "Missing \\begin_inset?.\n";
} else if (token == "\\begin_inset") { } else if (token == "\\begin_inset") {
Inset * inset = readInset(lex, buf); Inset * inset = readInset(lex, buf);
if (inset) if (inset)
@ -1114,8 +1104,7 @@ void Text::getWord(CursorSlice & from, CursorSlice & to,
--from.pos(); --from.pos();
break; break;
case NEXT_WORD: case NEXT_WORD:
lyxerr << "Text::getWord: NEXT_WORD not implemented yet" LYXERR0("Text::getWord: NEXT_WORD not implemented yet");
<< endl;
break; break;
case PARTIAL_WORD: case PARTIAL_WORD:
// no need to move the 'from' cursor // no need to move the 'from' cursor
@ -1180,14 +1169,12 @@ bool Text::read(Buffer const & buf, Lexer & lex, ErrorList & errorList)
} else if (token == "\\begin_deeper") { } else if (token == "\\begin_deeper") {
++depth; ++depth;
} else if (token == "\\end_deeper") { } else if (token == "\\end_deeper") {
if (!depth) { if (!depth)
lex.printError("\\end_deeper: " "depth is already null"); lex.printError("\\end_deeper: " "depth is already null");
} else { else
--depth; --depth;
}
} else { } else {
lyxerr << "Handling unknown body token: `" LYXERR0("Handling unknown body token: `" << token << '\'');
<< token << '\'' << endl;
} }
} }
return true; return true;

View File

@ -31,11 +31,9 @@
#include "Changes.h" #include "Changes.h"
#include "Cursor.h" #include "Cursor.h"
#include "CutAndPaste.h" #include "CutAndPaste.h"
#include "support/debug.h"
#include "DispatchResult.h" #include "DispatchResult.h"
#include "ErrorList.h" #include "ErrorList.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "support/gettext.h"
#include "Language.h" #include "Language.h"
#include "Layout.h" #include "Layout.h"
#include "Lexer.h" #include "Lexer.h"
@ -57,9 +55,10 @@
#include "mathed/InsetMathHull.h" #include "mathed/InsetMathHull.h"
#include "support/debug.h"
#include "support/gettext.h"
#include "support/textutils.h" #include "support/textutils.h"
#include <boost/current_function.hpp>
#include <boost/next_prior.hpp> #include <boost/next_prior.hpp>
#include <sstream> #include <sstream>

View File

@ -69,7 +69,6 @@
#include "mathed/InsetMathHull.h" #include "mathed/InsetMathHull.h"
#include "mathed/MathMacroTemplate.h" #include "mathed/MathMacroTemplate.h"
#include <boost/current_function.hpp>
#include <boost/next_prior.hpp> #include <boost/next_prior.hpp>
#include <clocale> #include <clocale>
@ -507,8 +506,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_CHAR_FORWARD: case LFUN_CHAR_FORWARD:
case LFUN_CHAR_FORWARD_SELECT: case LFUN_CHAR_FORWARD_SELECT:
//lyxerr << BOOST_CURRENT_FUNCTION //LYXERR0(" LFUN_CHAR_FORWARD[SEL]:\n" << cur);
// << " LFUN_CHAR_FORWARD[SEL]:\n" << cur << endl;
needsUpdate |= cur.selHandle(cmd.action == LFUN_CHAR_FORWARD_SELECT); needsUpdate |= cur.selHandle(cmd.action == LFUN_CHAR_FORWARD_SELECT);
needsUpdate |= cursorForward(cur); needsUpdate |= cursorForward(cur);
@ -1739,8 +1737,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
break; break;
default: default:
LYXERR(Debug::ACTION, BOOST_CURRENT_FUNCTION LYXERR(Debug::ACTION, "Command " << cmd << " not DISPATCHED by Text");
<< ": Command " << cmd << " not DISPATCHED by Text");
cur.undispatched(); cur.undispatched();
break; break;
} }

View File

@ -49,8 +49,6 @@
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"
#include <boost/current_function.hpp>
using std::make_pair; using std::make_pair;
using std::max; using std::max;
using std::min; using std::min;
@ -1221,8 +1219,7 @@ void TextMetrics::newParMetricsUp()
pit_type TextMetrics::getPitNearY(int y) pit_type TextMetrics::getPitNearY(int y)
{ {
BOOST_ASSERT(!text_->paragraphs().empty()); BOOST_ASSERT(!text_->paragraphs().empty());
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "y: " << y << " cache size: " << par_metrics_.size());
<< ": y: " << y << " cache size: " << par_metrics_.size());
// look for highest numbered paragraph with y coordinate less than given y // look for highest numbered paragraph with y coordinate less than given y
pit_type pit = -1; pit_type pit = -1;
@ -1262,8 +1259,7 @@ pit_type TextMetrics::getPitNearY(int y)
} }
for (; it != et; ++it) { for (; it != et; ++it) {
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "examining: pit: " << it->first
<< " examining: pit: " << it->first
<< " y: " << it->second.position()); << " y: " << it->second.position());
ParagraphMetrics const & pm = par_metrics_[it->first]; ParagraphMetrics const & pm = par_metrics_[it->first];
@ -1274,8 +1270,7 @@ pit_type TextMetrics::getPitNearY(int y)
} }
} }
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "found best y: " << yy << " for pit: " << pit);
<< ": found best y: " << yy << " for pit: " << pit);
return pit; return pit;
} }
@ -1364,8 +1359,8 @@ void TextMetrics::setCursorFromCoordinates(Cursor & cur, int const x, int const
ParagraphMetrics const & pm = par_metrics_[pit]; ParagraphMetrics const & pm = par_metrics_[pit];
int yy = pm.position() - pm.ascent(); int yy = pm.position() - pm.ascent();
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "x: " << x << " y: " << y <<
<< ": x: " << x << " y: " << y << " pit: " << pit << " yy: " << yy); " pit: " << pit << " yy: " << yy);
int r = 0; int r = 0;
BOOST_ASSERT(pm.rows().size()); BOOST_ASSERT(pm.rows().size());
@ -1378,15 +1373,13 @@ void TextMetrics::setCursorFromCoordinates(Cursor & cur, int const x, int const
Row const & row = pm.rows()[r]; Row const & row = pm.rows()[r];
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "row " << r << " from pos: " << row.pos());
<< ": row " << r << " from pos: " << row.pos());
bool bound = false; bool bound = false;
int xx = x; int xx = x;
pos_type const pos = row.pos() + getColumnNearX(pit, row, xx, bound); pos_type const pos = row.pos() + getColumnNearX(pit, row, xx, bound);
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "setting cursor pit: " << pit << " pos: " << pos);
<< ": setting cursor pit: " << pit << " pos: " << pos);
text_->setCursor(cur, pit, pos, true, bound); text_->setCursor(cur, pit, pos, true, bound);
// remember new position. // remember new position.
@ -1403,41 +1396,36 @@ Inset * TextMetrics::checkInsetHit(int x, int y)
Paragraph const & par = text_->paragraphs()[pit]; Paragraph const & par = text_->paragraphs()[pit];
ParagraphMetrics const & pm = par_metrics_[pit]; ParagraphMetrics const & pm = par_metrics_[pit];
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "x: " << x << " y: " << y << " pit: " << pit);
<< ": x: " << x << " y: " << y << " pit: " << pit);
InsetList::const_iterator iit = par.insetList().begin(); InsetList::const_iterator iit = par.insetList().begin();
InsetList::const_iterator iend = par.insetList().end(); InsetList::const_iterator iend = par.insetList().end();
for (; iit != iend; ++iit) { for (; iit != iend; ++iit) {
Inset * inset = iit->inset; Inset * inset = iit->inset;
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "examining inset " << inset);
<< ": examining inset " << inset);
if (!bv_->coordCache().getInsets().has(inset)) { if (!bv_->coordCache().getInsets().has(inset)) {
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "inset has no cached position");
<< ": inset has no cached position");
return 0; return 0;
} }
Dimension const & dim = pm.insetDimension(inset); Dimension const & dim = pm.insetDimension(inset);
Point p = bv_->coordCache().getInsets().xy(inset); Point p = bv_->coordCache().getInsets().xy(inset);
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "xo: " << p.x_ << "..." << p.x_ + dim.wid
<< ": xo: " << p.x_ << "..." << p.x_ + dim.wid
<< " yo: " << p.y_ - dim.asc << "..." << p.y_ + dim.des); << " yo: " << p.y_ - dim.asc << "..." << p.y_ + dim.des);
if (x >= p.x_ if (x >= p.x_
&& x <= p.x_ + dim.wid && x <= p.x_ + dim.wid
&& y >= p.y_ - dim.asc && y >= p.y_ - dim.asc
&& y <= p.y_ + dim.des) { && y <= p.y_ + dim.des) {
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "Hit inset: " << inset);
<< ": Hit inset: " << inset);
return inset; return inset;
} }
} }
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << ": No inset hit. "); LYXERR(Debug::DEBUG, "No inset hit. ");
return 0; return 0;
} }

View File

@ -64,7 +64,6 @@
#include "support/ExceptionMessage.h" #include "support/ExceptionMessage.h"
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/current_function.hpp>
#include <sstream> #include <sstream>

View File

@ -19,11 +19,9 @@
#include "BufferParams.h" #include "BufferParams.h"
#include "BufferView.h" #include "BufferView.h"
#include "Cursor.h" #include "Cursor.h"
#include "support/debug.h"
//#include "DialogView.h" //#include "DialogView.h"
//#include "DockView.h" //#include "DockView.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "support/gettext.h"
#include "GuiView.h" #include "GuiView.h"
#include "Lexer.h" #include "Lexer.h"
#include "Paragraph.h" #include "Paragraph.h"
@ -31,13 +29,14 @@
#include "qt_helpers.h" #include "qt_helpers.h"
#include "Spacing.h" #include "Spacing.h"
#include "support/debug.h"
#include "support/gettext.h"
#include <QCheckBox> #include <QCheckBox>
#include <QCloseEvent> #include <QCloseEvent>
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
#include <boost/current_function.hpp>
#include <sstream> #include <sstream>
using std::istringstream; using std::istringstream;

View File

@ -55,7 +55,6 @@
#include <QTimer> #include <QTimer>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/current_function.hpp>
#ifdef Q_WS_X11 #ifdef Q_WS_X11
#include <QX11Info> #include <QX11Info>
@ -238,9 +237,8 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & lv)
// PageStep only depends on the viewport height. // PageStep only depends on the viewport height.
verticalScrollBar()->setPageStep(viewport()->height()); verticalScrollBar()->setPageStep(viewport()->height());
LYXERR(Debug::GUI, BOOST_CURRENT_FUNCTION LYXERR(Debug::GUI, "viewport width: " << viewport()->width()
<< "\n viewport width\t" << viewport()->width() << " viewport height: " << viewport()->height());
<< "\n viewport height\t" << viewport()->height());
// Enables input methods for asian languages. // Enables input methods for asian languages.
// Must be set when creating custom text editing widgets. // Must be set when creating custom text editing widgets.
@ -648,18 +646,15 @@ void GuiWorkArea::keyPressEvent(QKeyEvent * ev)
#ifdef Q_WS_X11 #ifdef Q_WS_X11
if (XEventsQueued(QX11Info::display(), 0) > 1 && ev->isAutoRepeat() if (XEventsQueued(QX11Info::display(), 0) > 1 && ev->isAutoRepeat()
&& (Qt::Key_PageDown || Qt::Key_PageUp)) { && (Qt::Key_PageDown || Qt::Key_PageUp)) {
LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION LYXERR(Debug::KEY, "system is busy: scroll key event ignored");
<< "\nsystem is busy: scroll key event ignored");
ev->ignore(); ev->ignore();
return; return;
} }
#endif #endif
LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION LYXERR(Debug::KEY, " count: " << ev->count()
<< " count=" << ev->count() << " text: " << fromqstr(ev->text())
<< " text=" << fromqstr(ev->text()) << " isAutoRepeat: " << ev->isAutoRepeat() << " key: " << ev->key());
<< " isAutoRepeat=" << ev->isAutoRepeat()
<< " key=" << ev->key());
KeySymbol sym; KeySymbol sym;
setKeySymbol(&sym, ev); setKeySymbol(&sym, ev);
@ -701,12 +696,8 @@ void GuiWorkArea::update(int x, int y, int w, int h)
void GuiWorkArea::paintEvent(QPaintEvent * ev) void GuiWorkArea::paintEvent(QPaintEvent * ev)
{ {
QRect const rc = ev->rect(); QRect const rc = ev->rect();
/* // LYXERR(Debug::PAINTING, "paintEvent begin: x: " << rc.x()
LYXERR(Debug::PAINTING) << "paintEvent begin: x: " << rc.x() // << " y: " << rc.y() << " w: " << rc.width() << " h: " << rc.height());
<< " y: " << rc.y()
<< " w: " << rc.width()
<< " h: " << rc.height() << endl;
*/
if (need_resize_) { if (need_resize_) {
verticalScrollBar()->setPageStep(viewport()->height()); verticalScrollBar()->setPageStep(viewport()->height());
@ -765,14 +756,13 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
if (!commit_string.isEmpty()) { if (!commit_string.isEmpty()) {
LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION LYXERR(Debug::KEY, "preeditString: " << fromqstr(e->preeditString())
<< " preeditString =" << fromqstr(e->preeditString()) << " commitString: " << fromqstr(e->commitString()));
<< " commitString =" << fromqstr(e->commitString()));
int key = 0; int key = 0;
// FIXME Iwami 04/01/07: we should take care also of UTF16 surrogates here. // FIXME Iwami 04/01/07: we should take care also of UTF16 surrogates here.
for (int i = 0; i < commit_string.size(); ++i) { for (int i = 0; i != commit_string.size(); ++i) {
QKeyEvent ev(QEvent::KeyPress, key, Qt::NoModifier, commit_string[i]); QKeyEvent ev(QEvent::KeyPress, key, Qt::NoModifier, commit_string[i]);
keyPressEvent(&ev); keyPressEvent(&ev);
} }
@ -820,7 +810,7 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
// cursor_pos : cursor position in preedit string. // cursor_pos : cursor position in preedit string.
size_t cursor_pos = 0; size_t cursor_pos = 0;
bool cursor_is_visible = false; bool cursor_is_visible = false;
for (int i = 0; i < att.size(); ++i) { for (int i = 0; i != att.size(); ++i) {
if (att.at(i).type == QInputMethodEvent::Cursor) { if (att.at(i).type == QInputMethodEvent::Cursor) {
cursor_pos = att.at(i).start; cursor_pos = att.at(i).start;
cursor_is_visible = att.at(i).length != 0; cursor_is_visible = att.at(i).length != 0;
@ -837,7 +827,7 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
// rLength : selected string length in IM. // rLength : selected string length in IM.
size_t rLength = 0; size_t rLength = 0;
if (cursor_pos < preedit_length) { if (cursor_pos < preedit_length) {
for (int i = 0; i < att.size(); ++i) { for (int i = 0; i != att.size(); ++i) {
if (att.at(i).type == QInputMethodEvent::TextFormat) { if (att.at(i).type == QInputMethodEvent::TextFormat) {
if (att.at(i).start <= int(cursor_pos) if (att.at(i).start <= int(cursor_pos)
&& int(cursor_pos) < att.at(i).start + att.at(i).length) { && int(cursor_pos) < att.at(i).start + att.at(i).length) {

View File

@ -21,12 +21,10 @@
#include "BufferView.h" #include "BufferView.h"
#include "CoordCache.h" #include "CoordCache.h"
#include "Cursor.h" #include "Cursor.h"
#include "support/debug.h"
#include "Dimension.h" #include "Dimension.h"
#include "DispatchResult.h" #include "DispatchResult.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "FuncStatus.h" #include "FuncStatus.h"
#include "support/gettext.h"
#include "Text.h" #include "Text.h"
#include "TextClass.h" #include "TextClass.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
@ -36,8 +34,8 @@
#include "frontends/Application.h" #include "frontends/Application.h"
#include "support/convert.h" #include "support/convert.h"
#include "support/debug.h"
#include <boost/current_function.hpp> #include "support/gettext.h"
#include <map> #include <map>
@ -204,13 +202,13 @@ bool Inset::getStatus(Cursor &, FuncRequest const & cmd,
void Inset::edit(Cursor &, bool) void Inset::edit(Cursor &, bool)
{ {
LYXERR(Debug::INSETS, BOOST_CURRENT_FUNCTION << ": edit left/right"); LYXERR(Debug::INSETS, "edit left/right");
} }
Inset * Inset::editXY(Cursor &, int x, int y) Inset * Inset::editXY(Cursor &, int x, int y)
{ {
LYXERR(Debug::INSETS, BOOST_CURRENT_FUNCTION << ": x=" << x << " y= " << y); LYXERR(Debug::INSETS, "x: " << x << " y: " << y);
return this; return this;
} }
@ -218,9 +216,9 @@ Inset * Inset::editXY(Cursor &, int x, int y)
Inset::idx_type Inset::index(row_type row, col_type col) const Inset::idx_type Inset::index(row_type row, col_type col) const
{ {
if (row != 0) if (row != 0)
LYXERR0(BOOST_CURRENT_FUNCTION << ": illegal row: " << row); LYXERR0("illegal row: " << row);
if (col != 0) if (col != 0)
LYXERR0(BOOST_CURRENT_FUNCTION << ": illegal col: " << col); LYXERR0("illegal col: " << col);
return 0; return 0;
} }

View File

@ -21,19 +21,17 @@
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/textutils.h" #include "support/textutils.h"
#include <boost/current_function.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
using std::endl; using std::endl;
namespace lyx { namespace lyx {
MathData & InsetMath::cell(idx_type) MathData & InsetMath::cell(idx_type)
{ {
static MathData dummyCell; static MathData dummyCell;
lyxerr << BOOST_CURRENT_FUNCTION << ": I don't have any cell" << endl; LYXERR0("I don't have any cell");
return dummyCell; return dummyCell;
} }
@ -41,7 +39,7 @@ MathData & InsetMath::cell(idx_type)
MathData const & InsetMath::cell(idx_type) const MathData const & InsetMath::cell(idx_type) const
{ {
static MathData dummyCell; static MathData dummyCell;
lyxerr << BOOST_CURRENT_FUNCTION << ": I don't have any cell" << endl; LYXERR0("I don't have any cell");
return dummyCell; return dummyCell;
} }
@ -59,13 +57,13 @@ void InsetMath::dump() const
void InsetMath::metricsT(TextMetricsInfo const &, Dimension &) const void InsetMath::metricsT(TextMetricsInfo const &, Dimension &) const
{ {
lyxerr << "InsetMath::metricsT(Text) called directly!" << endl; LYXERR0("InsetMath::metricsT(Text) called directly!");
} }
void InsetMath::drawT(TextPainter &, int, int) const void InsetMath::drawT(TextPainter &, int, int) const
{ {
lyxerr << "InsetMath::drawT(Text) called directly!" << endl; LYXERR0("InsetMath::drawT(Text) called directly!");
} }

View File

@ -18,7 +18,6 @@
#include "support/unicode.h" #include "support/unicode.h"
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/current_function.hpp>
#include <cerrno> #include <cerrno>
@ -77,10 +76,9 @@ Messages::Messages(string const & l)
: lang_(l), warned_(false) : lang_(l), warned_(false)
{ {
// strip off any encoding suffix, i.e., assume 8-bit po files // strip off any encoding suffix, i.e., assume 8-bit po files
string::size_type i = lang_.find("."); size_t i = lang_.find(".");
lang_ = lang_.substr(0, i); lang_ = lang_.substr(0, i);
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION LYXERR(Debug::DEBUG, "language(" << lang_ << ")");
<< ": language(" << lang_ << ")");
} }
@ -91,16 +89,14 @@ void Messages::init()
char const * c = bindtextdomain(PACKAGE, locale_dir.c_str()); char const * c = bindtextdomain(PACKAGE, locale_dir.c_str());
int e = errno; int e = errno;
if (e) { if (e) {
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n' LYXERR(Debug::DEBUG, "Error code: " << errno << '\n'
<< "Error code: " << errno << '\n'
<< "Directory : " << package().locale_dir().absFilename() << '\n' << "Directory : " << package().locale_dir().absFilename() << '\n'
<< "Rtn value : " << c); << "Rtn value : " << c);
} }
if (!bind_textdomain_codeset(PACKAGE, ucs4_codeset)) { if (!bind_textdomain_codeset(PACKAGE, ucs4_codeset)) {
LYXERR(Debug::DEBUG, BOOST_CURRENT_FUNCTION << '\n' LYXERR(Debug::DEBUG, "Error code: " << errno << '\n'
<< "Error code: " << errno << '\n' << "Codeset : " << ucs4_codeset);
<< "Codeset : " << ucs4_codeset << '\n');
} }
textdomain(PACKAGE); textdomain(PACKAGE);

View File

@ -167,11 +167,25 @@ extern LyXErr lyxerr;
} // namespace lyx } // namespace lyx
// stolen from boost/current_function.hpp
#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600))
# define CURRENT_FUNCTION __PRETTY_FUNCTION__
#elif defined(__FUNCSIG__)
# define CURRENT_FUNCTION __FUNCSIG__
#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500))
# define CURRENT_FUNCTION __FUNCTION__
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
# define CURRENT_FUNCTION __FUNC__
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
# define CURRENT_FUNCTION __func__
#else
# define CURRENT_FUNCTION "(unknown)"
#endif
#define LYXERR(type, msg) \ #define LYXERR(type, msg) \
do { \ do { \
if (!lyx::lyxerr.debugging(type)) {} \ if (!lyx::lyxerr.debugging(type)) {} \
else { lyx::lyxerr << msg; lyx::lyxerr.endl(); } \ else { lyx::lyxerr << CURRENT_FUNCTION <<": "<<msg; lyx::lyxerr.endl(); } \
} while (0) } while (0)
#define LYXERR0(msg) LYXERR(lyx::Debug::ANY, msg) #define LYXERR0(msg) LYXERR(lyx::Debug::ANY, msg)