2001-12-05 08:04:20 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-02-28 11:56:36 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2001-02-13 13:28:32 +00:00
|
|
|
#include "math_dotsinset.h"
|
2001-11-08 12:06:56 +00:00
|
|
|
#include "math_mathmlstream.h"
|
2001-12-05 08:04:20 +00:00
|
|
|
#include "math_streamstr.h"
|
2001-11-08 12:15:12 +00:00
|
|
|
#include "math_support.h"
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
2001-09-03 15:22:55 +00:00
|
|
|
MathDotsInset::MathDotsInset(string const & name)
|
|
|
|
: name_(name)
|
2001-06-25 00:06:33 +00:00
|
|
|
{}
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
MathInset * MathDotsInset::clone() const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-06-25 00:06:33 +00:00
|
|
|
return new MathDotsInset(*this);
|
2002-03-21 17:42:56 +00:00
|
|
|
}
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathDotsInset::metrics(MathMetricsInfo & mi) const
|
2002-03-19 16:55:58 +00:00
|
|
|
{
|
2002-05-30 07:09:54 +00:00
|
|
|
mathed_char_dim(mi.base.font, 'M', ascent_, descent_, width_);
|
2002-05-29 15:58:26 +00:00
|
|
|
if (name_ == "ldots" || name_ == "dotsm")
|
|
|
|
dh_ = 0;
|
|
|
|
else if (name_ == "cdots" || name_ == "dotsb"
|
|
|
|
|| name_ == "dotsm" || name_ == "dotsi")
|
|
|
|
dh_ = ascent_ / 2;
|
|
|
|
else if (name_ == "dotsc")
|
|
|
|
dh_ = ascent_ / 4;
|
|
|
|
else if (name_ == "vdots")
|
|
|
|
width_ /= 2;
|
|
|
|
else if (name_ == "ddots")
|
|
|
|
dh_ = ascent_;
|
2002-03-21 17:42:56 +00:00
|
|
|
}
|
2002-03-19 16:55:58 +00:00
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathDotsInset::draw(MathPainterInfo & pain, int x, int y) const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-09-03 15:22:55 +00:00
|
|
|
mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
|
2002-05-29 15:58:26 +00:00
|
|
|
if (name_ == "vdots" || name_ == "ddots")
|
2001-04-25 15:43:57 +00:00
|
|
|
++x;
|
2002-05-29 15:58:26 +00:00
|
|
|
if (name_ != "vdots")
|
2001-04-25 15:43:57 +00:00
|
|
|
--y;
|
2001-09-03 15:22:55 +00:00
|
|
|
mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
void MathDotsInset::write(WriteStream & os) const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-12-05 08:04:20 +00:00
|
|
|
os << '\\' << name_ << ' ';
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
2001-04-25 15:43:57 +00:00
|
|
|
|
2001-04-27 12:35:55 +00:00
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
void MathDotsInset::normalize(NormalStream & os) const
|
2001-04-25 15:43:57 +00:00
|
|
|
{
|
2001-12-05 08:04:20 +00:00
|
|
|
os << "[" << name_ << "] ";
|
2001-04-25 15:43:57 +00:00
|
|
|
}
|