- Dump parpos cache if you use -dbg workarea on command line

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15419 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Asger Ottar Alstrup 2006-10-20 20:57:21 +00:00
parent 2b01ca42d8
commit e035d673ff
3 changed files with 27 additions and 1 deletions

View File

@ -1365,6 +1365,10 @@ void BufferView::updateMetrics(bool singlepar)
<< endl; << endl;
metrics_info_ = ViewMetricsInfo(pit1, pit2, y1, y2, singlepar, size); metrics_info_ = ViewMetricsInfo(pit1, pit2, y1, y2, singlepar, size);
if (lyxerr.debugging(Debug::WORKAREA)) {
coord_cache_.dump();
}
} }

View File

@ -49,4 +49,24 @@ Point CoordCache::get(LyXText const * text, lyx::pit_type pit)
return posit->second; return posit->second;
} }
void
CoordCache::dump() const {
lyxerr << "ParPosCache contains:" << std::endl;
for (ParPosCache::const_iterator i = getParPos().begin(); i != getParPos().end(); ++i) {
LyXText const * lt = (*i).first;
InnerParPosCache const & cache = (*i).second;
lyxerr << "LyXText:" << lt << std::endl;
for (InnerParPosCache::const_iterator j = cache.begin(); j != cache.end(); ++j) {
pit_type pit = (*j).first;
Paragraph const & par = lt->getPar(pit);
Point p = (*j).second;
lyxerr << "Paragraph " << pit << ": \"";
for (int k = 0; k < std::min(10, par.size()); ++k) {
lyxerr << lyx::to_utf8(docstring(1,par.getChar(k)));
}
lyxerr << "\" has point " << p.x_ << "," << p.y_ << std::endl;
}
}
}
} // namespace lyx } // namespace lyx

View File

@ -105,7 +105,7 @@ private:
* A global cache that allows us to come from a paragraph in a document * A global cache that allows us to come from a paragraph in a document
* to a position point on the screen. * to a position point on the screen.
* All points cached in this cache are only valid between subsequent * All points cached in this cache are only valid between subsequent
* updated. (x,y) == (0,0) is the upper left screen corner, x increases * updates. (x,y) == (0,0) is the upper left screen corner, x increases
* to the right, y increases downwords. * to the right, y increases downwords.
* The cache is built in BufferView::updateMetrics which is called * The cache is built in BufferView::updateMetrics which is called
* from BufferView::Pimpl::update. The individual points are added * from BufferView::Pimpl::update. The individual points are added
@ -142,6 +142,8 @@ public:
return boundary ? slices1_ : slices0_; return boundary ? slices1_ : slices0_;
} }
/// Dump the contents of the cache to lyxerr in debugging form
void dump() const;
private: private:
/// MathArrays /// MathArrays
CoordCacheBase<MathArray> arrays_; CoordCacheBase<MathArray> arrays_;