2001-02-13 13:28:32 +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"
|
|
|
|
#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-06-25 00:06:33 +00:00
|
|
|
MathDotsInset::MathDotsInset(string const & name, int id)
|
|
|
|
: MathInset(name, LM_OT_DOTS), code_(id)
|
|
|
|
{}
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
2001-06-25 00:06:33 +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-06-25 00:06:33 +00:00
|
|
|
mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, code_);
|
2001-04-25 15:43:57 +00:00
|
|
|
if (code_ == LM_vdots || code_ == LM_ddots)
|
|
|
|
++x;
|
|
|
|
if (code_ != LM_vdots)
|
|
|
|
--y;
|
2001-06-25 00:06:33 +00:00
|
|
|
mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, code_);
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-25 00:06:33 +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-02-16 09:25:43 +00:00
|
|
|
switch (code_) {
|
2001-04-25 15:43:57 +00:00
|
|
|
case LM_ldots: dh_ = 0; break;
|
2001-06-25 00:06:33 +00:00
|
|
|
case LM_cdots: dh_ = ascent_/2; break;
|
|
|
|
case LM_vdots: width_ /= 2;
|
|
|
|
case LM_ddots: dh_ = ascent_; break;
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
void MathDotsInset::Write(ostream & os, bool /* fragile */) const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-06-25 00:06:33 +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-06-25 00:06:33 +00:00
|
|
|
void MathDotsInset::WriteNormal(ostream & os) const
|
2001-04-25 15:43:57 +00:00
|
|
|
{
|
2001-06-25 00:06:33 +00:00
|
|
|
os << "[" << name() << "] ";
|
2001-04-25 15:43:57 +00:00
|
|
|
}
|