]> git.lyx.org Git - features.git/commitdiff
- Avoid lyxerr[] like the plague. Use if (lyxerr.debugging( ... )) instead.
authorAsger Ottar Alstrup <alstrup@lyx.org>
Tue, 7 Nov 2006 21:31:33 +0000 (21:31 +0000)
committerAsger Ottar Alstrup <alstrup@lyx.org>
Tue, 7 Nov 2006 21:31:33 +0000 (21:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15792 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C
src/frontends/WorkArea.C
src/rowpainter.C
src/text.C

index f09269112951c3a995a4ed7c8b79d6ee7cd15d26..39c8da3162fa7937a02aed839964b2219a31f679 100644 (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
index ec44b875a421526a16afcc630a0c317f3485716f..2d6663cf4d6acec823d8ad17ad2b706f603c0ce7 100644 (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();
 
index e35755041168e3a2cb2ed2dc950dc516e121e427..fdb3450e6407679b09c51d90fc9ce9b2853d8b10 100644 (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
index a933287f9151a5f847d3f3278254a01d91919c98..872ef17c1bf785fcb5495f60ed24783a52911038 100644 (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,