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-07-26 16:14:23 +00:00
|
|
|
#include "mathed/math_parser.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-07-26 16:14:23 +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
|
|
|
|
|
|
|
|
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-04-25 15:43:57 +00:00
|
|
|
void MathDotsInset::draw(Painter & pain, int x, int y)
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-07-26 16:14:23 +00:00
|
|
|
mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, key_->id);
|
|
|
|
if (key_->id == LM_vdots || key_->id == LM_ddots)
|
2001-04-25 15:43:57 +00:00
|
|
|
++x;
|
2001-07-26 16:14:23 +00:00
|
|
|
if (key_->id != LM_vdots)
|
2001-04-25 15:43:57 +00:00
|
|
|
--y;
|
2001-07-26 16:14:23 +00:00
|
|
|
mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, key_->id);
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-26 06:56:43 +00:00
|
|
|
void MathDotsInset::metrics(MathStyles st)
|
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-07-26 16:14:23 +00:00
|
|
|
switch (key_->id) {
|
2001-04-25 15:43:57 +00:00
|
|
|
case LM_ldots: dh_ = 0; break;
|
2001-07-26 16:14:23 +00:00
|
|
|
case LM_cdots: dh_ = ascent_ / 2; break;
|
2001-06-25 00:06:33 +00:00
|
|
|
case LM_vdots: width_ /= 2;
|
|
|
|
case LM_ddots: 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-07-26 16:14:23 +00:00
|
|
|
os << '\\' << key_->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-07-26 16:14:23 +00:00
|
|
|
os << "[" << key_->name << "] ";
|
2001-04-25 15:43:57 +00:00
|
|
|
}
|