]> git.lyx.org Git - lyx.git/blob - src/CoordCache.cpp
initial basic context menu support.
[lyx.git] / src / CoordCache.cpp
1 /* \file CoordCache.cpp
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
14 #include "Text.h"
15
16 #include "support/debug.h"
17 #include "support/docstring.h"
18
19 #include "insets/Inset.h"
20
21 #include <boost/assert.hpp>
22
23
24 namespace lyx {
25
26 Point::Point(int x, int y)
27         : x_(x), y_(y)
28 {
29         BOOST_ASSERT(x > -1000000);
30         BOOST_ASSERT(x <  1000000);
31         BOOST_ASSERT(y > -1000000);
32         BOOST_ASSERT(y <  1000000);
33 }
34
35 // just a helper to be able to set a breakpoint
36 void lyxbreaker(void const * data, const char * hint, int size)
37 {
38         LYXERR0("break on pointer: " << data << " hint: " << hint
39                 << " size: " << size);
40         BOOST_ASSERT(false);
41 }
42
43
44 void CoordCache::clear()
45 {
46         arrays_.clear();
47         insets_.clear();
48 }
49
50
51 void CoordCache::dump() const
52 {
53         LYXERR0("InsetCache contains:");
54         for (CoordCacheBase<Inset>::cache_type::const_iterator it = getInsets().getData().begin(); it != getInsets().getData().end(); ++it) {
55                 Inset const * inset = it->first;
56                 Point const p = it->second.pos;
57                 LYXERR0("Inset " << inset << "(" << to_utf8(inset->name())
58                         << ") has point " << p.x_ << "," << p.y_);
59         }
60 }
61
62 } // namespace lyx