mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 05:33:33 +00:00
811980f739
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2365 a592a061-630c-0410-9148-cb99ea01b6c8
55 lines
941 B
C
55 lines
941 B
C
#include "math_symbolinset.h"
|
|
#include "mathed/math_parser.h"
|
|
#include "support/LOstream.h"
|
|
|
|
|
|
using std::ostream;
|
|
|
|
MathSymbolInset::MathSymbolInset(const latexkeys * l)
|
|
: sym_(l)
|
|
{}
|
|
|
|
|
|
MathInset * MathSymbolInset::clone() const
|
|
{
|
|
return new MathSymbolInset(*this);
|
|
}
|
|
|
|
|
|
void MathSymbolInset::write(ostream & os, bool /* fragile */) const
|
|
{
|
|
os << '\\' << sym_->name << ' ';
|
|
}
|
|
|
|
|
|
void MathSymbolInset::writeNormal(ostream & os) const
|
|
{
|
|
os << "[bigop " << sym_->name << "] ";
|
|
}
|
|
|
|
|
|
void MathSymbolInset::metrics(MathStyles st)
|
|
{
|
|
size(st);
|
|
|
|
if (sym_->id > 0 && sym_->id < 256) {
|
|
ssym_ = string();
|
|
ssym_ += sym_->id;
|
|
code_ = (sym_->token == LM_TK_BIGSYM) ? LM_TC_BSYM : LM_TC_SYMB;
|
|
} else {
|
|
ssym_ = sym_->name;
|
|
code_ = LM_TC_TEXTRM;
|
|
}
|
|
|
|
mathed_string_dim(code_, size(), ssym_, ascent_, descent_, width_);
|
|
}
|
|
|
|
|
|
void MathSymbolInset::draw(Painter & pain, int x, int y)
|
|
{
|
|
xo(x);
|
|
yo(y);
|
|
|
|
drawStr(pain, code_, size_, x, y, ssym_);
|
|
}
|