2001-07-27 10:08:04 +00:00
|
|
|
#include "math_symbolinset.h"
|
2001-07-26 14:37:09 +00:00
|
|
|
#include "mathed/math_parser.h"
|
2001-02-14 15:00:50 +00:00
|
|
|
#include "support/LOstream.h"
|
|
|
|
|
2001-07-12 07:18:29 +00:00
|
|
|
|
2001-02-14 15:00:50 +00:00
|
|
|
using std::ostream;
|
2001-02-13 13:28:32 +00:00
|
|
|
|
2001-07-27 10:08:04 +00:00
|
|
|
MathSymbolInset::MathSymbolInset(const latexkeys * l)
|
2001-07-26 14:37:09 +00:00
|
|
|
: sym_(l)
|
2001-07-26 10:55:07 +00:00
|
|
|
{}
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
2001-07-27 10:08:04 +00:00
|
|
|
MathInset * MathSymbolInset::clone() const
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-07-27 10:08:04 +00:00
|
|
|
return new MathSymbolInset(*this);
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-27 10:08:04 +00:00
|
|
|
void MathSymbolInset::write(ostream & os, bool /* fragile */) const
|
2001-02-28 11:56:36 +00:00
|
|
|
{
|
2001-07-26 15:28:45 +00:00
|
|
|
os << '\\' << sym_->name << ' ';
|
2001-02-28 11:56:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-27 10:08:04 +00:00
|
|
|
void MathSymbolInset::writeNormal(ostream & os) const
|
2001-04-25 15:43:57 +00:00
|
|
|
{
|
2001-07-26 14:37:09 +00:00
|
|
|
os << "[bigop " << sym_->name << "] ";
|
2001-04-25 15:43:57 +00:00
|
|
|
}
|
|
|
|
|
2001-07-12 07:18:29 +00:00
|
|
|
|
2001-07-27 10:08:04 +00:00
|
|
|
void MathSymbolInset::metrics(MathStyles st)
|
2001-02-13 13:28:32 +00:00
|
|
|
{
|
2001-06-25 00:06:33 +00:00
|
|
|
size(st);
|
2001-02-13 13:28:32 +00:00
|
|
|
|
2001-07-26 14:37:09 +00:00
|
|
|
if (sym_->id > 0 && sym_->id < 256) {
|
2001-07-12 07:18:29 +00:00
|
|
|
ssym_ = string();
|
2001-07-26 14:37:09 +00:00
|
|
|
ssym_ += sym_->id;
|
2001-07-26 15:28:45 +00:00
|
|
|
code_ = (sym_->token == LM_TK_BIGSYM) ? LM_TC_BSYM : LM_TC_SYMB;
|
2001-02-13 13:28:32 +00:00
|
|
|
} else {
|
2001-07-26 14:37:09 +00:00
|
|
|
ssym_ = sym_->name;
|
2001-07-12 07:18:29 +00:00
|
|
|
code_ = LM_TC_TEXTRM;
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|
2001-06-27 14:10:35 +00:00
|
|
|
|
2001-07-26 06:46:50 +00:00
|
|
|
mathed_string_dim(code_, size(), ssym_, ascent_, descent_, width_);
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-27 10:08:04 +00:00
|
|
|
void MathSymbolInset::draw(Painter & pain, int x, int y)
|
2001-07-12 07:18:29 +00:00
|
|
|
{
|
2001-06-25 00:06:33 +00:00
|
|
|
xo(x);
|
|
|
|
yo(y);
|
2001-06-27 14:10:35 +00:00
|
|
|
|
2001-07-26 06:46:50 +00:00
|
|
|
drawStr(pain, code_, size_, x, y, ssym_);
|
2001-02-13 13:28:32 +00:00
|
|
|
}
|