* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author André Pönitz
+ * \author André Pönitz
*
* Full author contact details are available in file CREDITS.
*/
#include "MathStream.h"
#include "MathSupport.h"
#include "frontends/Painter.h"
-#include "debug.h"
+#include "support/debug.h"
+using namespace std;
namespace lyx {
-using std::max;
-
-
InsetMathXYArrow::InsetMathXYArrow()
: InsetMathNest(2)
{}
-std::auto_ptr<InsetBase> InsetMathXYArrow::clone() const
+Inset * InsetMathXYArrow::clone() const
{
- return std::auto_ptr<InsetBase>(new InsetMathXYArrow(*this));
+ return new InsetMathXYArrow(*this);
}
}
-MathArray const & InsetMathXYArrow::targetCell() const
+MathData const & InsetMathXYArrow::targetCell() const
{
#if 0
InsetMathXYMatrix const * p = targetMatrix();
int x = 0;
int y = 0;
- MathArray const & t = cell(0);
- for (MathArray::const_iterator it = t.begin(); it != t.end(); ++it) {
+ MathData const & t = cell(0);
+ for (MathData::const_iterator it = t.begin(); it != t.end(); ++it) {
switch ((*it)->getChar()) {
case 'l': --x; break;
case 'r': ++x; break;
}
return p->cell(n);
#else
- static MathArray dummy;
+ static MathData dummy;
return dummy;
#endif
}
-MathArray const & InsetMathXYArrow::sourceCell() const
+MathData const & InsetMathXYArrow::sourceCell() const
{
#if 0
return targetMatrix()->cell(mi_.idx);
#else
- static MathArray dummy;
+ static MathData dummy;
return dummy;
#endif
}
if (editing()) {
int w = mathed_string_width(mi.base.font, from_ascii("target: "));
- width_ = w + max(cell(0).width(), cell(1).width());
- ascent_ = cell(0).ascent();
- descent_ = cell(0).descent() + cell(1).height() + 10;
+ width_ = w + max(dim0.width(), dim1.wid);
+ ascent_ = dim0.asc;
+ descent_ = dim0.des + dim1.height() + 10;
} else {
width_ = 0;
ascent_ = 0;
cell(0).draw(pi, x + lwid, y);
pi.base.text(x + 3, y, "target");
- y += max(cell(0).descent(), ldes) + 5;
+ y += max(dim0.des, ldes) + 5;
- y += max(cell(1).ascent(), lasc) + 5;
+ y += max(dim1.asc, lasc) + 5;
cell(1).draw(pi, x + lwid, y);
pi.base.text(x + 3, y, "label");
} else {
pi.pain.text(x, y, "X");
- MathArray const & s = sourceCell();
- MathArray const & t = targetCell();
- pi.pain.line(s.xm(), s.ym(), t.xm(), t.ym(), LColor::math);
+ MathData const & s = sourceCell();
+ MathData const & t = targetCell();
+ pi.pain.line(s.xm(), s.ym(), t.xm(), t.ym(), Color_math);
cell(1).draw(pi, (s.xm() + t.xm())/2, (s.ym() + t.ym())/2);
}
void InsetMathXYArrow::write(WriteStream & os) const
{
+ MathEnsurer ensurer(os);
os << "\\ar";
if (cell(0).size())
os << '[' << cell(0) << ']';