2001-12-05 08:04:20 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
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"
|
2002-07-17 10:25:33 +00:00
|
|
|
#include "math_parser.h"
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
2002-07-17 10:25:33 +00:00
|
|
|
MathDotsInset::MathDotsInset(latexkeys const * key)
|
|
|
|
: key_(key)
|
2001-06-25 00:06:33 +00:00
|
|
|
{}
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
2003-06-16 11:49:38 +00:00
|
|
|
InsetBase * 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
|
|
|
|
|
|
|
|
2003-06-02 10:03:27 +00:00
|
|
|
void MathDotsInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-03-19 16:55:58 +00:00
|
|
|
{
|
2002-07-11 11:27:24 +00:00
|
|
|
mathed_char_dim(mi.base.font, 'M', dim_);
|
2002-12-09 09:52:43 +00:00
|
|
|
dh_ = 0;
|
|
|
|
if (key_->name == "cdots" || key_->name == "dotsb"
|
2002-07-17 10:25:33 +00:00
|
|
|
|| key_->name == "dotsm" || key_->name == "dotsi")
|
2003-05-28 13:22:36 +00:00
|
|
|
dh_ = dim_.asc / 2;
|
2002-07-17 10:25:33 +00:00
|
|
|
else if (key_->name == "dotsc")
|
2003-05-28 13:22:36 +00:00
|
|
|
dh_ = dim_.asc / 4;
|
2002-11-25 10:15:13 +00:00
|
|
|
else if (key_->name == "vdots") {
|
2003-05-27 13:55:03 +00:00
|
|
|
dim_.wid = (dim_.wid / 2) + 1;
|
2003-05-28 13:22:36 +00:00
|
|
|
dh_ = dim_.asc;
|
2002-11-25 10:15:13 +00:00
|
|
|
}
|
2002-07-17 10:25:33 +00:00
|
|
|
else if (key_->name == "ddots")
|
2003-05-28 13:22:36 +00:00
|
|
|
dh_ = dim_.asc;
|
2003-06-02 10:03:27 +00:00
|
|
|
dim = dim_;
|
2002-03-21 17:42:56 +00:00
|
|
|
}
|
2002-03-19 16:55:58 +00:00
|
|
|
|
|
|
|
|
2003-03-21 14:20:48 +00:00
|
|
|
void MathDotsInset::draw(PainterInfo & pain, int x, int y) const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2003-05-28 13:22:36 +00:00
|
|
|
mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
|
|
|
|
key_->name);
|
2002-07-17 10:25:33 +00:00
|
|
|
if (key_->name == "vdots" || key_->name == "ddots")
|
2001-04-25 15:43:57 +00:00
|
|
|
++x;
|
2002-07-17 10:25:33 +00:00
|
|
|
if (key_->name != "vdots")
|
2001-04-25 15:43:57 +00:00
|
|
|
--y;
|
2003-05-28 13:22:36 +00:00
|
|
|
mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
|
|
|
|
key_->name);
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-05 07:09:11 +00:00
|
|
|
string MathDotsInset::name() const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2002-08-05 07:09:11 +00:00
|
|
|
return key_->name;
|
2001-04-25 15:43:57 +00:00
|
|
|
}
|