2001-06-25 00:06:33 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "math_sizeinset.h"
|
2001-06-27 15:33:55 +00:00
|
|
|
#include "support/LOstream.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
MathSizeInset::MathSizeInset(MathStyles st)
|
2001-08-03 17:10:22 +00:00
|
|
|
: MathNestInset(1), style_(st)
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
|
|
|
name_ = verbose();
|
|
|
|
}
|
|
|
|
|
2001-06-27 15:33:55 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
char const * MathSizeInset::verbose() const
|
|
|
|
{
|
|
|
|
switch (style_) {
|
|
|
|
case LM_ST_DISPLAY:
|
|
|
|
return "displaystyle";
|
|
|
|
case LM_ST_TEXT:
|
|
|
|
return "textstyle";
|
|
|
|
case LM_ST_SCRIPT:
|
|
|
|
return "scriptstyle";
|
|
|
|
case LM_ST_SCRIPTSCRIPT:
|
|
|
|
return "scriptscriptstyle";
|
|
|
|
}
|
|
|
|
return "unknownstyle";
|
|
|
|
}
|
|
|
|
|
2001-06-27 15:33:55 +00:00
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
MathInset * MathSizeInset::clone() const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
|
|
|
return new MathSizeInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathSizeInset::draw(Painter & pain, int x, int y)
|
|
|
|
{
|
|
|
|
xo(x);
|
|
|
|
yo(y);
|
|
|
|
xcell(0).draw(pain, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-26 06:56:43 +00:00
|
|
|
void MathSizeInset::metrics(MathStyles /* st */)
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
2001-07-26 06:56:43 +00:00
|
|
|
xcell(0).metrics(style_);
|
2001-06-25 00:06:33 +00:00
|
|
|
ascent_ = xcell(0).ascent_;
|
|
|
|
descent_ = xcell(0).descent_;
|
|
|
|
width_ = xcell(0).width_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-26 06:56:43 +00:00
|
|
|
void MathSizeInset::write(std::ostream & os, bool fragile) const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
|
|
|
os << "{\\" << name() << " ";
|
2001-07-26 06:56:43 +00:00
|
|
|
cell(0).write(os, fragile);
|
2001-06-25 00:06:33 +00:00
|
|
|
os << "}";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-26 06:56:43 +00:00
|
|
|
void MathSizeInset::writeNormal(std::ostream & os) const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
|
|
|
os << "[" << name() << " ";
|
2001-07-26 06:56:43 +00:00
|
|
|
cell(0).writeNormal(os);
|
2001-06-25 00:06:33 +00:00
|
|
|
os << "]";
|
|
|
|
}
|