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
|
|
|
|
|
|
|
|
|
|
|
MathDotsInset::MathDotsInset(string const & nam, int id, short st)
|
2001-02-16 09:25:43 +00:00
|
|
|
: MathedInset(nam, LM_OT_DOTS, st), code_(id) {}
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
MathedInset * MathDotsInset::Clone()
|
|
|
|
{
|
2001-02-16 09:25:43 +00:00
|
|
|
return new MathDotsInset(name, code_, GetStyle());
|
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-02-16 09:25:43 +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-02-16 09:25:43 +00:00
|
|
|
mathed_draw_deco(pain, x + 2, y - dh_, width - 2, ascent, code_);
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-04-25 15:43:57 +00:00
|
|
|
void MathDotsInset::Metrics()
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-02-15 12:22:01 +00:00
|
|
|
mathed_char_height(LM_TC_VAR, size(), 'M', ascent, descent);
|
|
|
|
width = mathed_char_width(LM_TC_VAR, size(), 'M');
|
2001-02-16 09:25:43 +00:00
|
|
|
switch (code_) {
|
2001-04-25 15:43:57 +00:00
|
|
|
case LM_ldots: dh_ = 0; break;
|
|
|
|
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-04-25 15:43:57 +00:00
|
|
|
void MathDotsInset::Write(ostream & os, bool /* fragile */)
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
|
|
|
os << '\\' << name << ' ';
|
|
|
|
}
|
2001-04-25 15:43:57 +00:00
|
|
|
|
2001-04-27 12:35:55 +00:00
|
|
|
|
2001-04-25 15:43:57 +00:00
|
|
|
void MathDotsInset::WriteNormal(ostream & os)
|
|
|
|
{
|
2001-04-27 12:35:55 +00:00
|
|
|
os << "[" << name << "] ";
|
2001-04-25 15:43:57 +00:00
|
|
|
}
|