diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 35ccdb24c5..0d2d466a85 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -596,7 +596,7 @@ bool BufferView::Pimpl::fitCursor() LyXFont const font = cursor_.getFont(); int const asc = font_metrics::maxAscent(font); int const des = font_metrics::maxDescent(font); - Point p = bv_funcs::getPos(cursor_); + Point const p = bv_funcs::getPos(cursor_); if (p.y_ - asc >= 0 && p.y_ + des < workarea().workHeight()) return false; } @@ -607,11 +607,12 @@ bool BufferView::Pimpl::fitCursor() void BufferView::Pimpl::update(Update::flags flags) { - lyxerr << BOOST_CURRENT_FUNCTION - << "[fitcursor = " << (flags & Update::FitCursor) - << ", forceupdate = " << (flags & Update::Force) - << ", singlepar = " << (flags & Update::SinglePar) - << "] buffer: " << buffer_ << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << "[fitcursor = " << (flags & Update::FitCursor) + << ", forceupdate = " << (flags & Update::Force) + << ", singlepar = " << (flags & Update::SinglePar) + << "] buffer: " << buffer_ << endl; // Check needed to survive LyX startup if (buffer_) { @@ -1289,11 +1290,12 @@ ViewMetricsInfo BufferView::Pimpl::metrics(bool singlepar) int pit2 = pit; size_t const npit = text->paragraphs().size(); - lyxerr << BOOST_CURRENT_FUNCTION - << " npit: " << npit - << " pit1: " << pit1 - << " pit2: " << pit2 - << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << " npit: " << npit + << " pit1: " << pit1 + << " pit2: " << pit2 + << endl; // Rebreak anchor par text->redoParagraph(pit); @@ -1343,10 +1345,11 @@ ViewMetricsInfo BufferView::Pimpl::metrics(bool singlepar) y += text->getPar(pit).descent(); } - lyxerr << BOOST_CURRENT_FUNCTION - << " y1: " << y1 - << " y2: " << y2 - << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << " y1: " << y1 + << " y2: " << y2 + << endl; return ViewMetricsInfo(pit1, pit2, y1, y2, singlepar); } diff --git a/src/ChangeLog b/src/ChangeLog index 736a50d3bb..3ddfd73a3f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2005-07-14 Lars Gullik Bjønnes + + * BufferView_pimpl.C (update): dampen some of the debug blabbering + * factory.C (readInset): ditto + * text.C, text2.C: ditto + 2005-06-21 Jean-Marc Lasgouttes * buffer.C: format incremented to 242. There is no file format per diff --git a/src/factory.C b/src/factory.C index 9b3258a593..272133df69 100644 --- a/src/factory.C +++ b/src/factory.C @@ -477,7 +477,10 @@ InsetBase * readInset(LyXLex & lex, Buffer const & buf) static_cast(inset.get()); MacroTable::globalMacros().insert (tmpl->name(), tmpl->asMacroData()); - lyxerr << "creating local macro " << tmpl->name() << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << ": creating local macro " << tmpl->name() + << endl; } } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 2c5e1cada8..f7371690d6 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2005-07-14 Lars Gullik Bjønnes + + * insettext.C (doDispatch): reduce some debug blabbering + 2005-07-10 Georg Baum * ExternalSupport.C (subst_path): adjust to latex_path changes and diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 854eedc989..0b9f8cad59 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -299,8 +299,11 @@ InsetBase * InsetText::editXY(LCursor & cur, int x, int y) const void InsetText::doDispatch(LCursor & cur, FuncRequest & cmd) { - lyxerr << BOOST_CURRENT_FUNCTION - << " [ cmd.action = " << cmd.action << ']' << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << " [ cmd.action = " << cmd.action << ']' + << endl; + setViewCache(&cur.bv()); text_.dispatch(cur, cmd); diff --git a/src/text.C b/src/text.C index 517aa19778..d43486d460 100644 --- a/src/text.C +++ b/src/text.C @@ -195,10 +195,14 @@ void readParToken(Buffer const & buf, Paragraph & par, LyXLex & lex, par.params().read(lex); } else if (token == "\\end_layout") { - lyxerr << "Solitary \\end_layout in line " << lex.getLineNo() << "\n" + lyxerr << BOOST_CURRENT_FUNCTION + << ": Solitary \\end_layout in line " + << lex.getLineNo() << "\n" << "Missing \\begin_layout?.\n"; } else if (token == "\\end_inset") { - lyxerr << "Solitary \\end_inset in line " << lex.getLineNo() << "\n" + lyxerr << BOOST_CURRENT_FUNCTION + << ": Solitary \\end_inset in line " + << lex.getLineNo() << "\n" << "Missing \\begin_inset?.\n"; } else if (token == "\\begin_inset") { InsetBase * inset = readInset(lex, buf); @@ -779,7 +783,7 @@ void LyXText::setRowWidth(pit_type const pit, Row & row) const pos_type const end = row.endpos(); Paragraph const & par = pars_[pit]; - string labelsep = par.layout()->labelsep; + string const & labelsep = par.layout()->labelsep; int w = leftMargin(pit, row.pos()); pos_type const body_pos = par.beginOfBody(); @@ -1832,7 +1836,10 @@ void LyXText::drawSelection(PainterInfo & pi, int x, int) const if (!ptr_cmp(cur.text(), this)) return; - lyxerr << "draw selection at " << x << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << "draw selection at " << x + << endl; // is there a better way of getting these two iterators? DocIterator beg = cur; @@ -2269,8 +2276,12 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y) { pit_type pit = getPitNearY(y); int yy = theCoords.get(this, pit).y_ - pars_[pit].ascent(); - lyxerr << "setCursorFromCoordinates: x: " << x << " y: " << y - << " pit: " << pit << " yy: " << yy << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << ": x: " << x + << " y: " << y + << " pit: " << pit + << " yy: " << yy << endl; Paragraph const & par = pars_[pit]; int r = 0; @@ -2284,8 +2295,11 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y) Row const & row = par.rows()[r]; - lyxerr << "setCursorFromCoordinates: row " << r - << " from pos: " << row.pos() << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << ": row " << r + << " from pos: " << row.pos() + << endl; bool bound = false; int xx = x; diff --git a/src/text2.C b/src/text2.C index 7b51412d69..f7fbeeaace 100644 --- a/src/text2.C +++ b/src/text2.C @@ -103,30 +103,45 @@ InsetBase * LyXText::checkInsetHit(int x, int y) const Paragraph const & par = pars_[pit]; - lyxerr << "checkInsetHit: x: " << x << " y: " << y << endl; - lyxerr << " pit: " << pit << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << ": x: " << x + << " y: " << y + << " pit: " << pit + << endl; InsetList::const_iterator iit = par.insetlist.begin(); InsetList::const_iterator iend = par.insetlist.end(); for (; iit != iend; ++iit) { InsetBase * inset = iit->inset; #if 1 - lyxerr << "examining inset " << inset << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << ": examining inset " << inset << endl; + if (theCoords.getInsets().has(inset)) - lyxerr - << " xo: " << inset->xo() << "..." + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << ": xo: " << inset->xo() << "..." << inset->xo() + inset->width() << " yo: " << inset->yo() - inset->ascent() << "..." - << inset->yo() + inset->descent() << endl; + << inset->yo() + inset->descent() + << endl; else - lyxerr << " inset has no cached position" << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << ": inset has no cached position" << endl; #endif if (inset->covers(x, y)) { - lyxerr << "Hit inset: " << inset << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << ": Hit inset: " << inset << endl; return inset; } } - lyxerr << "No inset hit. " << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << ": No inset hit. " << endl; return 0; } @@ -849,8 +864,10 @@ pit_type LyXText::getPitNearY(int y) const BOOST_ASSERT(!paragraphs().empty()); BOOST_ASSERT(theCoords.getParPos().find(this) != theCoords.getParPos().end()); CoordCache::InnerParPosCache const & cc = theCoords.getParPos().find(this)->second; - lyxerr << "LyXText::getPitNearY: y: " << y << " cache size: " - << cc.size() << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << ": y: " << y << " cache size: " << cc.size() + << endl; // look for highest numbered paragraph with y coordinate less than given y pit_type pit = 0; @@ -858,15 +875,23 @@ pit_type LyXText::getPitNearY(int y) const CoordCache::InnerParPosCache::const_iterator it = cc.begin(); CoordCache::InnerParPosCache::const_iterator et = cc.end(); for (; it != et; ++it) { - lyxerr << " examining: pit: " << it->first << " y: " - << it->second.y_ << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << " examining: pit: " << it->first + << " y: " << it->second.y_ + << endl; + if (it->first >= pit && int(it->second.y_) - int(pars_[it->first].ascent()) <= y) { pit = it->first; yy = it->second.y_; } } - lyxerr << " found best y: " << yy << " for pit: " << pit << endl; + lyxerr[Debug::DEBUG] + << BOOST_CURRENT_FUNCTION + << ": found best y: " << yy << " for pit: " << pit + << endl; + return pit; }