#include "MathSupport.h"
#include "MathReplace.h"
-#include "coordcache.h"
-#include "LColor.h"
#include "BufferView.h"
#include "buffer.h"
#include "cursor.h"
#include "debug.h"
+#include "LColor.h"
#include "frontends/Painter.h"
#include <boost/assert.hpp>
+using lyx::odocstream;
+
using std::abs;
using std::endl;
using std::min;
void MathArray::dump2() const
{
- NormalStream ns(lyxerr);
+ lyx::odocstringstream os;
+ NormalStream ns(os);
for (const_iterator it = begin(); it != end(); ++it)
ns << *it << ' ';
+ lyxerr << lyx::to_utf8(os.str());
}
void MathArray::dump() const
{
- NormalStream ns(lyxerr);
+ lyx::odocstringstream os;
+ NormalStream ns(os);
for (const_iterator it = begin(); it != end(); ++it)
ns << '<' << *it << '>';
+ lyxerr << lyx::to_utf8(os.str());
}
void MathArray::draw(PainterInfo & pi, int x, int y) const
{
//lyxerr << "MathArray::draw: x: " << x << " y: " << y << endl;
- setXY(x, y);
+ setXY(*pi.base.bv, x, y);
if (empty()) {
pi.pain.rectangle(x, y - ascent(), width(), height(), LColor::mathline);
}
}
#endif
- theCoords.insets().add(at.nucleus(), x, y);
+ //BufferView & bv = *pi.base.bv;
+ pi.base.bv->coordCache().insets().add(at.nucleus(), x, y);
at->drawSelection(pi, x, y);
at->draw(pi, x, y);
x += at->width();
void MathArray::drawT(TextPainter & pain, int x, int y) const
{
//lyxerr << "x: " << x << " y: " << y << ' ' << pain.workAreaHeight() << endl;
- setXY(x, y);
+
+ // FIXME: Abdel 16/10/2006
+ // This drawT() method is never used, this is dead code.
for (const_iterator it = begin(), et = end(); it != et; ++it) {
(*it)->drawT(pain, x, y);
}
-int MathArray::dist(int x, int y) const
+int MathArray::dist(BufferView & bv, int x, int y) const
{
int xx = 0;
int yy = 0;
- const int xo_ = xo();
- const int yo_ = yo();
+ const int xo_ = xo(bv);
+ const int yo_ = yo(bv);
if (x < xo_)
xx = xo_ - x;
}
-void MathArray::setXY(int x, int y) const
+void MathArray::setXY(BufferView & bv, int x, int y) const
{
//lyxerr << "setting position cache for MathArray " << this << std::endl;
- theCoords.arrays().add(this, x, y);
+ bv.coordCache().arrays().add(this, x, y);
+}
+
+
+int MathArray::xo(BufferView & bv) const
+{
+ return bv.coordCache().getArrays().x(this);
+}
+
+
+int MathArray::yo(BufferView & bv) const
+{
+ return bv.coordCache().getArrays().y(this);
}
-int MathArray::xo() const
+std::ostream & operator<<(std::ostream & os, MathArray const & ar)
{
- return theCoords.getArrays().x(this);
+ lyx::odocstringstream oss;
+ NormalStream ns(oss);
+ ns << ar;
+ return os << lyx::to_utf8(oss.str());
}
-int MathArray::yo() const
+odocstream & operator<<(odocstream & os, MathArray const & ar)
{
- return theCoords.getArrays().y(this);
+ NormalStream ns(os);
+ ns << ar;
+ return os;
}