#include "math_support.h"
#include "math_replace.h"
+#include "coordcache.h"
#include "LColor.h"
#include "BufferView.h"
#include "buffer.h"
MathArray::MathArray()
- : xo_(0), yo_(0)
{}
MathArray::MathArray(const_iterator from, const_iterator to)
- : base_type(from, to), xo_(0), yo_(0)
+ : base_type(from, to)
{}
void MathArray::draw(PainterInfo & pi, int x, int y) const
{
//lyxerr << "MathArray::draw: x: " << x << " y: " << y << endl;
- xo_ = x;
- yo_ = y;
+ setXY(x, y);
if (empty()) {
pi.pain.rectangle(x, y - ascent(), width(), height(), LColor::mathline);
void MathArray::drawT(TextPainter & pain, int x, int y) const
{
//lyxerr << "x: " << x << " y: " << y << ' ' << pain.workAreaHeight() << endl;
- xo_ = x;
- yo_ = y;
+ setXY(x, y);
for (const_iterator it = begin(), et = end(); it != et; ++it) {
(*it)->drawT(pain, x, y);
int xx = 0;
int yy = 0;
+ const int xo_ = xo();
+ const int yo_ = yo();
+
if (x < xo_)
xx = xo_ - x;
else if (x > xo_ + width())
void MathArray::setXY(int x, int y) const
{
- xo_ = x;
- yo_ = y;
+ //lyxerr << "setting position cache for MathArray " << this << std::endl;
+ theCoords.arrays_.add(this, x, y);
+}
+
+
+int MathArray::xo() const
+{
+ return theCoords.arrays_.x(this);
}
+
+
+int MathArray::yo() const
+{
+ return theCoords.arrays_.y(this);
+}
+