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"
|
|
|
|
#include "mathed/support.h"
|
2001-02-14 15:00:50 +00:00
|
|
|
#include "support/LOstream.h"
|
|
|
|
|
|
|
|
using std::ostream;
|
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-08-06 17:20:26 +00:00
|
|
|
void MathDotsInset::metrics(MathStyles st) const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-06-25 00:06:33 +00:00
|
|
|
size(st);
|
|
|
|
mathed_char_dim(LM_TC_VAR, size(), '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-07-26 06:56:43 +00:00
|
|
|
void MathDotsInset::write(ostream & os, bool /* fragile */) const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-09-03 15:22:55 +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-07-26 06:56:43 +00:00
|
|
|
void MathDotsInset::writeNormal(ostream & os) const
|
2001-04-25 15:43:57 +00:00
|
|
|
{
|
2001-09-03 15:22:55 +00:00
|
|
|
os << "[" << name_ << "] ";
|
2001-04-25 15:43:57 +00:00
|
|
|
}
|