- Avoid lyxerr[] like the plague. Use if (lyxerr.debugging( ... )) instead.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15792 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Asger Ottar Alstrup 2006-11-07 21:31:33 +00:00
parent d3218b9acb
commit 44b212878b
4 changed files with 38 additions and 22 deletions

View File

@ -355,7 +355,9 @@ bool BufferView::update(Update::flags flags)
if (!buffer_)
return false;
lyxerr[Debug::WORKAREA] << "BufferView::update" << std::endl;
if (lyxerr.debugging(Debug::WORKAREA)) {
lyxerr[Debug::WORKAREA] << "BufferView::update" << std::endl;
}
// Update macro store
buffer_->buildMacros();
@ -388,11 +390,13 @@ void BufferView::updateScrollbar()
offset_ref_ = 0;
}
lyxerr[Debug::GUI]
<< BOOST_CURRENT_FUNCTION
<< " Updating scrollbar: height: " << t.paragraphs().size()
<< " curr par: " << cursor_.bottom().pit()
<< " default height " << defaultRowHeight() << endl;
if (lyxerr.debugging(Debug::GUI)) {
lyxerr[Debug::GUI]
<< BOOST_CURRENT_FUNCTION
<< " Updating scrollbar: height: " << t.paragraphs().size()
<< " curr par: " << cursor_.bottom().pit()
<< " default height " << defaultRowHeight() << endl;
}
// It would be better to fix the scrollbar to understand
// values in [0..1] and divide everything by wh

View File

@ -153,7 +153,9 @@ void WorkArea::redraw(bool singlePar)
ViewMetricsInfo const & vi = buffer_view_->viewMetricsInfo();
greyed_out_ = false;
lyxerr[Debug::WORKAREA] << "WorkArea::redraw screen" << endl;
if (lyxerr.debugging(Debug::WORKAREA)) {
lyxerr[Debug::WORKAREA] << "WorkArea::redraw screen" << endl;
}
int const ymin = std::max(vi.y1, 0);
int const ymax = vi.p2 < vi.size - 1 ? vi.y2 : height();

View File

@ -182,7 +182,9 @@ void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
bool tmp = refreshInside;
if (!in || !in->wide()) {
refreshInside = true;
lyxerr[Debug::PAINTING] << endl << "Paint inset fully" << endl;
if (lyxerr.debugging(Debug::PAINTING)) {
lyxerr << endl << "Paint inset fully" << endl;
}
}
if (refreshInside)
inset->drawSelection(pi, int(x_), yo_);
@ -921,12 +923,14 @@ void paintPar
// Instrumentation for testing row cache (see also
// 12 lines lower):
if (text.isMainText(*pi.base.bv->buffer()))
lyxerr[Debug::PAINTING] << "#";
else
lyxerr[Debug::PAINTING] << "[" <<
repaintAll << row_has_changed <<
cursor_on_row << "]";
if (lyxerr.debugging(Debug::PAINTING)) {
if (text.isMainText(*pi.base.bv->buffer()))
lyxerr[Debug::PAINTING] << "#";
else
lyxerr[Debug::PAINTING] << "[" <<
repaintAll << row_has_changed <<
cursor_on_row << "]";
}
rp.paintAppendix();
rp.paintDepthBar();
rp.paintChangeBar();
@ -943,7 +947,9 @@ void paintPar
// Re-enable screen drawing for future use of the painter.
pi.pain.setDrawingEnabled(true);
lyxerr[Debug::PAINTING] << "." << endl;
if (lyxerr.debugging(Debug::PAINTING)) {
lyxerr[Debug::PAINTING] << "." << endl;
}
}
} // namespace anon

View File

@ -1962,10 +1962,12 @@ void LyXText::drawSelection(PainterInfo & pi, int x, int) const
if (!ptr_cmp(cur.text(), this))
return;
lyxerr[Debug::DEBUG]
<< BOOST_CURRENT_FUNCTION
<< "draw selection at " << x
<< endl;
if (lyxerr.debugging(Debug::DEBUG)) {
lyxerr[Debug::DEBUG]
<< BOOST_CURRENT_FUNCTION
<< "draw selection at " << x
<< endl;
}
DocIterator beg = cur.selectionBegin();
DocIterator end = cur.selectionEnd();
@ -2037,9 +2039,11 @@ void LyXText::drawSelection(PainterInfo & pi, int x, int) const
return;
}
lyxerr[Debug::DEBUG] << " y1: " << y1 << " y2: " << y2
<< "X1:" << X1 << " x2: " << X2 << " wid: " << dim_.wid
<< endl;
if (lyxerr.debugging(Debug::DEBUG)) {
lyxerr[Debug::DEBUG] << " y1: " << y1 << " y2: " << y2
<< "X1:" << X1 << " x2: " << X2 << " wid: " << dim_.wid
<< endl;
}
// paint upper rectangle
pi.pain.fillRectangle(x + x1, y1, x2 - x1, y2 - y1,