mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
simplify BigopInset handling
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2360 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d812b509d0
commit
1db325d20c
@ -1,13 +1,12 @@
|
|||||||
#include "math_bigopinset.h"
|
#include "math_bigopinset.h"
|
||||||
#include "Painter.h"
|
#include "mathed/math_parser.h"
|
||||||
#include "mathed/support.h"
|
|
||||||
#include "support/LOstream.h"
|
#include "support/LOstream.h"
|
||||||
|
|
||||||
|
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
|
|
||||||
MathBigopInset::MathBigopInset(string const & name, int id)
|
MathBigopInset::MathBigopInset(const latexkeys * l)
|
||||||
: MathInset(0, name), sym_(id)
|
: sym_(l)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -19,34 +18,30 @@ MathInset * MathBigopInset::clone() const
|
|||||||
|
|
||||||
void MathBigopInset::write(ostream & os, bool /* fragile */) const
|
void MathBigopInset::write(ostream & os, bool /* fragile */) const
|
||||||
{
|
{
|
||||||
//bool f = sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
|
os << '\\' << sym_->name;
|
||||||
os << '\\' << name();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathBigopInset::writeNormal(ostream & os) const
|
void MathBigopInset::writeNormal(ostream & os) const
|
||||||
{
|
{
|
||||||
os << "[bigop " << name() << "] ";
|
os << "[bigop " << sym_->name << "] ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathBigopInset::metrics(MathStyles st)
|
void MathBigopInset::metrics(MathStyles st)
|
||||||
{
|
{
|
||||||
//cerr << "\nBigopDraw: " << name_ << ": " << sym_ << "\n";
|
|
||||||
size(st);
|
size(st);
|
||||||
|
|
||||||
if (sym_ && (sym_ < 256 || sym_ == LM_oint)) {
|
if (sym_->id > 0 && sym_->id < 256) {
|
||||||
ssym_ = string();
|
ssym_ = string();
|
||||||
ssym_ += (sym_ == LM_oint) ? LM_int : sym_;
|
ssym_ += sym_->id;
|
||||||
code_ = LM_TC_BSYM;
|
code_ = LM_TC_BSYM;
|
||||||
} else {
|
} else {
|
||||||
ssym_ = name();
|
ssym_ = sym_->name;
|
||||||
code_ = LM_TC_TEXTRM;
|
code_ = LM_TC_TEXTRM;
|
||||||
}
|
}
|
||||||
|
|
||||||
mathed_string_dim(code_, size(), ssym_, ascent_, descent_, width_);
|
mathed_string_dim(code_, size(), ssym_, ascent_, descent_, width_);
|
||||||
if (sym_ == LM_oint)
|
|
||||||
width_ += 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -56,10 +51,4 @@ void MathBigopInset::draw(Painter & pain, int x, int y)
|
|||||||
yo(y);
|
yo(y);
|
||||||
|
|
||||||
drawStr(pain, code_, size_, x, y, ssym_);
|
drawStr(pain, code_, size_, x, y, ssym_);
|
||||||
|
|
||||||
if (sym_ == LM_oint) {
|
|
||||||
int xx = x - 1;
|
|
||||||
int yy = y - (ascent_ - descent_) / 2;
|
|
||||||
pain.arc(xx, yy, width_, width_, 0, 360 * 64, LColor::mathline);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,13 @@
|
|||||||
|
|
||||||
#include "math_inset.h"
|
#include "math_inset.h"
|
||||||
|
|
||||||
|
struct latexkeys;
|
||||||
|
|
||||||
/// big operators
|
/// big operators
|
||||||
class MathBigopInset : public MathInset {
|
class MathBigopInset : public MathInset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
MathBigopInset(string const &, int);
|
explicit MathBigopInset(latexkeys const *);
|
||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
@ -23,7 +25,7 @@ public:
|
|||||||
bool isScriptable() const { return true; }
|
bool isScriptable() const { return true; }
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
int sym_;
|
latexkeys const * sym_;
|
||||||
///
|
///
|
||||||
string ssym_;
|
string ssym_;
|
||||||
///
|
///
|
||||||
|
@ -667,7 +667,7 @@ void MathCursor::interpret(string const & s)
|
|||||||
switch (l->token) {
|
switch (l->token) {
|
||||||
case LM_TK_BIGSYM:
|
case LM_TK_BIGSYM:
|
||||||
case LM_TK_FUNCLIM:
|
case LM_TK_FUNCLIM:
|
||||||
p = new MathBigopInset(s, l->id);
|
p = new MathBigopInset(l);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LM_TK_SYM: {
|
case LM_TK_SYM: {
|
||||||
|
@ -184,7 +184,7 @@ latexkeys const wordlist[] =
|
|||||||
{"nu", LM_TK_SYM, LM_nu, LMB_NONE},
|
{"nu", LM_TK_SYM, LM_nu, LMB_NONE},
|
||||||
{"nwarrow", LM_TK_SYM, LM_nwarrow, LMB_NONE},
|
{"nwarrow", LM_TK_SYM, LM_nwarrow, LMB_NONE},
|
||||||
{"odot", LM_TK_SYM, LM_odot, LMB_OPERATOR},
|
{"odot", LM_TK_SYM, LM_odot, LMB_OPERATOR},
|
||||||
{"oint", LM_TK_BIGSYM, LM_oint, LMB_NONE},
|
//{"oint", LM_TK_BIGSYM, LM_oint, LMB_NONE},
|
||||||
{"omega", LM_TK_SYM, LM_omega, LMB_NONE},
|
{"omega", LM_TK_SYM, LM_omega, LMB_NONE},
|
||||||
{"ominus", LM_TK_SYM, LM_ominus, LMB_OPERATOR},
|
{"ominus", LM_TK_SYM, LM_ominus, LMB_OPERATOR},
|
||||||
{"oplus", LM_TK_SYM, LM_oplus, LMB_OPERATOR},
|
{"oplus", LM_TK_SYM, LM_oplus, LMB_OPERATOR},
|
||||||
|
@ -633,7 +633,7 @@ void mathed_parse(MathArray & array, unsigned flags)
|
|||||||
case LM_TK_BIGSYM:
|
case LM_TK_BIGSYM:
|
||||||
case LM_TK_FUNCLIM:
|
case LM_TK_FUNCLIM:
|
||||||
limits = 0;
|
limits = 0;
|
||||||
array.push_back(new MathBigopInset(yylval.l->name, yylval.l->id));
|
array.push_back(new MathBigopInset(yylval.l));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LM_TK_SYM:
|
case LM_TK_SYM:
|
||||||
|
Loading…
Reference in New Issue
Block a user