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-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);
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-06 17:20:26 +00:00
|
|
|
void MathDotsInset::draw(Painter & 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_);
|
|
|
|
char const c = name_[0];
|
|
|
|
if (c == 'v' || c == 'd')
|
2001-04-25 15:43:57 +00:00
|
|
|
++x;
|
2001-09-03 15:22:55 +00:00
|
|
|
if (c != 'v')
|
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-10-22 15:37:49 +00:00
|
|
|
void MathDotsInset::metrics(MathMetricsInfo const & mi) const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-10-22 15:37:49 +00:00
|
|
|
mathed_char_dim(LM_TC_VAR, mi, 'M', ascent_, descent_, width_);
|
2001-09-03 15:22:55 +00:00
|
|
|
switch (name_[0]) {
|
|
|
|
case 'l': dh_ = 0; break;
|
|
|
|
case 'c': dh_ = ascent_ / 2; break;
|
|
|
|
case 'v': width_ /= 2;
|
|
|
|
case 'd': dh_ = ascent_; break;
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-19 11:25:48 +00:00
|
|
|
void MathDotsInset::write(MathWriteInfo & os) const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-11-08 12:06:56 +00:00
|
|
|
os << '\\' << name_.c_str() << ' ';
|
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-08 12:06:56 +00:00
|
|
|
void MathDotsInset::writeNormal(NormalStream & os) const
|
2001-04-25 15:43:57 +00:00
|
|
|
{
|
2001-11-08 12:06:56 +00:00
|
|
|
os << "[" << name_.c_str() << "] ";
|
2001-04-25 15:43:57 +00:00
|
|
|
}
|