]> git.lyx.org Git - lyx.git/blob - src/coordcache.C
Fix bug 886 and others not reported related with the document paper size.
[lyx.git] / src / coordcache.C
1 /* \file coordcache.C
2  * This file is part of LyX, the document processor.
3  * Licence details can be found in the file COPYING.
4  *
5  * \author André Pönitz
6  *
7  * Full author contact details are available in file CREDITS.
8  */
9
10 #include <config.h>
11
12 #include "coordcache.h"
13 #include "debug.h"
14
15 #include "lyxtext.h"
16
17 #include "mathed/math_data.h"
18 #include "insets/insetbase.h"
19
20 #include <boost/assert.hpp>
21
22
23 CoordCache theCoords;
24
25 // just a helper to be able to set a breakpoint
26 void lyxbreaker(void const * data, const char * hint, int size)
27 {
28         lyxerr << "break on pointer: " << data << " hint: " << hint
29                 << " size: " << size << std::endl;
30         BOOST_ASSERT(false);
31 }
32
33
34 void CoordCache::clear()
35 {
36         BOOST_ASSERT(updating);
37         arrays_.clear();
38         insets_.clear();
39         pars_.clear();
40 }
41
42 void CoordCache::startUpdating() {
43         BOOST_ASSERT(!updating);
44         updating = true;
45 }
46
47
48 void CoordCache::doneUpdating() {
49         BOOST_ASSERT(updating);
50         updating = false;
51 }
52
53 Point CoordCache::get(LyXText const * text, lyx::pit_type pit)
54 {
55         ParPosCache::iterator const it = pars_.find(text);
56         BOOST_ASSERT(it != pars_.end());
57         InnerParPosCache::iterator const posit = it->second.find(pit);
58         BOOST_ASSERT(posit != it->second.end());
59         return posit->second;
60 }