]> git.lyx.org Git - features.git/commitdiff
- Dump parpos cache if you use -dbg workarea on command line
authorAsger Ottar Alstrup <alstrup@lyx.org>
Fri, 20 Oct 2006 20:57:21 +0000 (20:57 +0000)
committerAsger Ottar Alstrup <alstrup@lyx.org>
Fri, 20 Oct 2006 20:57:21 +0000 (20:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15419 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C
src/coordcache.C
src/coordcache.h

index ad86b9f9447182b3beb9eb05ca95922b6c8bcd77..26008cacd40ea2247779be5c394348eb081a6cb0 100644 (file)
@@ -1365,6 +1365,10 @@ void BufferView::updateMetrics(bool singlepar)
                << endl;
 
        metrics_info_ = ViewMetricsInfo(pit1, pit2, y1, y2, singlepar, size);
+
+       if (lyxerr.debugging(Debug::WORKAREA)) {
+               coord_cache_.dump();
+       }
 }
 
 
index f3647189fb6a8addab0b83081bb19c85857e6333..a7f8a511e2700956936a0da560cfea31c8c9fa03 100644 (file)
@@ -49,4 +49,24 @@ Point CoordCache::get(LyXText const * text, lyx::pit_type pit)
        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
index 4423b3459d1b8107ece61cfff1e50d05821c7f00..1b87794afd46bc893ed45fea29c90875ac6ad791 100644 (file)
@@ -105,7 +105,7 @@ private:
  * A global cache that allows us to come from a paragraph in a document
  * to a position point on the screen.
  * 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.
  * The cache is built in BufferView::updateMetrics which is called
  * from BufferView::Pimpl::update. The individual points are added
@@ -142,6 +142,8 @@ public:
                return boundary ? slices1_ : slices0_;
        }
 
+       /// Dump the contents of the cache to lyxerr in debugging form
+       void dump() const;
 private:
        /// MathArrays
        CoordCacheBase<MathArray> arrays_;