2002-02-05 13:27:34 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "math_xarrowinset.h"
|
|
|
|
#include "math_support.h"
|
|
|
|
#include "math_parser.h"
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
#include "math_streamstr.h"
|
|
|
|
|
|
|
|
|
|
|
|
MathXArrowInset::MathXArrowInset(string const & name)
|
2003-02-05 11:44:14 +00:00
|
|
|
: MathFracbaseInset(), name_(name)
|
2002-02-05 13:27:34 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * MathXArrowInset::clone() const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2002-02-05 13:27:34 +00:00
|
|
|
return new MathXArrowInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-21 14:20:48 +00:00
|
|
|
void MathXArrowInset::metrics(MetricsInfo & mi) const
|
2002-02-05 13:27:34 +00:00
|
|
|
{
|
2003-03-21 14:20:48 +00:00
|
|
|
ScriptChanger dummy(mi.base);
|
2002-08-02 14:29:42 +00:00
|
|
|
cell(0).metrics(mi);
|
2003-02-05 11:44:14 +00:00
|
|
|
cell(1).metrics(mi);
|
2003-05-27 13:55:03 +00:00
|
|
|
dim_.wid = std::max(cell(0).width(), cell(1).width()) + 10;
|
|
|
|
dim_.asc = cell(0).height() + 10;
|
|
|
|
dim_.des = cell(1).height();
|
2002-02-05 13:27:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-21 14:20:48 +00:00
|
|
|
void MathXArrowInset::draw(PainterInfo & pi, int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2003-03-21 14:20:48 +00:00
|
|
|
ScriptChanger dummy(pi.base);
|
2003-02-05 11:44:14 +00:00
|
|
|
cell(0).draw(pi, x + 5, y - 10);
|
|
|
|
cell(1).draw(pi, x + 5, y + cell(1).height());
|
|
|
|
mathed_draw_deco(pi, x + 1, y - 7, width() - 2, 5, name_);
|
2002-02-05 13:27:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathXArrowInset::write(WriteStream & os) const
|
|
|
|
{
|
2003-02-05 11:44:14 +00:00
|
|
|
os << '\\' << name_;
|
|
|
|
if (cell(1).size())
|
|
|
|
os << '[' << cell(1) << ']';
|
|
|
|
os << '{' << cell(0) << '}';
|
2002-02-05 13:27:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathXArrowInset::normalize(NormalStream & os) const
|
|
|
|
{
|
2003-02-05 11:44:14 +00:00
|
|
|
os << "[xarrow " << name_ << ' ' << cell(0) << ' ' << cell(1) << ']';
|
2002-02-05 13:27:34 +00:00
|
|
|
}
|