2007-04-26 04:41:58 +00:00
|
|
|
/* \file CoordCache.cpp
|
2005-04-26 10:30:24 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2005-04-26 10:30:24 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
2004-08-14 14:04:37 +00:00
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "CoordCache.h"
|
2004-08-14 14:04:37 +00:00
|
|
|
|
2007-04-29 23:33:02 +00:00
|
|
|
#include "Text.h"
|
2004-11-30 01:59:49 +00:00
|
|
|
|
2007-11-29 07:04:28 +00:00
|
|
|
#include "support/debug.h"
|
2007-11-14 21:57:43 +00:00
|
|
|
#include "support/docstring.h"
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
#include "insets/Inset.h"
|
2004-11-30 01:59:49 +00:00
|
|
|
|
2008-04-30 08:26:40 +00:00
|
|
|
#include "support/lassert.h"
|
2004-08-14 14:04:37 +00:00
|
|
|
|
2004-11-30 01:59:49 +00:00
|
|
|
|
2006-10-15 22:32:56 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
Point::Point(int x, int y)
|
|
|
|
: x_(x), y_(y)
|
|
|
|
{
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(x > -1000000, /**/);
|
|
|
|
LASSERT(x < 1000000, /**/);
|
|
|
|
LASSERT(y > -1000000, /**/);
|
|
|
|
LASSERT(y < 1000000, /**/);
|
2006-10-21 00:16:43 +00:00
|
|
|
}
|
|
|
|
|
2004-08-14 14:04:37 +00:00
|
|
|
// just a helper to be able to set a breakpoint
|
|
|
|
void lyxbreaker(void const * data, const char * hint, int size)
|
|
|
|
{
|
2007-11-28 22:12:03 +00:00
|
|
|
LYXERR0("break on pointer: " << data << " hint: " << hint
|
|
|
|
<< " size: " << size);
|
2011-04-25 01:46:37 +00:00
|
|
|
LASSERT(false, return);
|
2004-11-30 01:59:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-05 10:11:42 +00:00
|
|
|
void CoordCache::clear()
|
2004-08-14 14:04:37 +00:00
|
|
|
{
|
|
|
|
arrays_.clear();
|
|
|
|
insets_.clear();
|
|
|
|
}
|
|
|
|
|
2005-07-16 17:54:25 +00:00
|
|
|
|
2007-04-29 12:32:14 +00:00
|
|
|
void CoordCache::dump() const
|
|
|
|
{
|
2007-11-28 22:12:03 +00:00
|
|
|
LYXERR0("InsetCache contains:");
|
2011-03-23 16:25:43 +00:00
|
|
|
CoordCacheBase<Inset>::cache_type::const_iterator it =
|
2011-03-23 17:43:13 +00:00
|
|
|
getInsets().data_.begin();
|
|
|
|
for (; it != getInsets().data_.end(); ++it) {
|
2011-03-23 16:25:43 +00:00
|
|
|
// Warning: it is not guaranteed that inset is a valid pointer
|
|
|
|
// (therefore it has type 'void *') (see bug #7376).
|
|
|
|
void const * inset = it->first;
|
2007-09-23 22:39:49 +00:00
|
|
|
Point const p = it->second.pos;
|
2011-03-23 16:25:43 +00:00
|
|
|
LYXERR0("Inset " << inset << " has point " << p.x_ << "," << p.y_);
|
2006-10-21 10:56:36 +00:00
|
|
|
}
|
2006-10-20 20:57:21 +00:00
|
|
|
}
|
|
|
|
|
2006-10-15 22:32:56 +00:00
|
|
|
} // namespace lyx
|