fix 'vanishing \sin' bug

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4857 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-08-05 07:09:11 +00:00
parent f72aef6cb3
commit 9b4bf4c29d
13 changed files with 26 additions and 145 deletions

View File

@ -1332,7 +1332,7 @@ bool MathCursor::interpret(char c)
// handle macroMode // handle macroMode
if (inMacroMode()) { if (inMacroMode()) {
string name = macroName(); string name = macroName();
//lyxerr << "interpret name: '" << name << "'\n"; lyxerr << "interpret name: '" << name << "'\n";
if (name.empty() && c == '\\') { if (name.empty() && c == '\\') {
backspace(); backspace();
@ -1341,7 +1341,7 @@ bool MathCursor::interpret(char c)
} }
if (isalpha(c)) { if (isalpha(c)) {
inMacroMode()->name() += c; inMacroMode()->setName(inMacroMode()->name() + c);
return true; return true;
} }

View File

@ -50,13 +50,7 @@ void MathDotsInset::draw(MathPainterInfo & pain, int x, int y) const
} }
void MathDotsInset::write(WriteStream & os) const string MathDotsInset::name() const
{ {
os << '\\' << key_->name << ' '; return key_->name;
}
void MathDotsInset::normalize(NormalStream & os) const
{
os << "[" << key_->name << "] ";
} }

View File

@ -18,13 +18,11 @@ public:
/// ///
MathInset * clone() const; MathInset * clone() const;
/// ///
void draw(MathPainterInfo &, int x, int y) const; void metrics(MathMetricsInfo & mi) const;
/// ///
void write(WriteStream & os) const; void draw(MathPainterInfo & pi, int x, int y) const;
/// ///
void normalize(NormalStream &) const; string name() const;
///
void metrics(MathMetricsInfo & st) const;
protected: protected:
/// cache for the thing's heigth /// cache for the thing's heigth
mutable int dh_; mutable int dh_;

View File

@ -36,9 +36,9 @@ void MathExFuncInset::draw(MathPainterInfo & pi, int x, int y) const
} }
void MathExFuncInset::normalize(NormalStream & os) const string MathExFuncInset::name() const
{ {
os << '[' << name_ << ' ' << cell(0) << ']'; return name_;
} }
@ -89,9 +89,3 @@ void MathExFuncInset::octavize(OctaveStream & os) const
{ {
os << name_ << '(' << cell(0) << ')'; os << name_ << '(' << cell(0) << ')';
} }
void MathExFuncInset::write(WriteStream & os) const
{
os << '\\' << name_ << '{' << cell(0) << '}';
}

View File

@ -16,12 +16,12 @@ public:
/// ///
MathInset * clone() const; MathInset * clone() const;
/// ///
void metrics(MathMetricsInfo & st) const; void metrics(MathMetricsInfo & mi) const;
/// ///
void draw(MathPainterInfo &, int x, int y) const; void draw(MathPainterInfo & pi, int x, int y) const;
///
string name() const;
///
void normalize(NormalStream &) const;
/// ///
void maplize(MapleStream &) const; void maplize(MapleStream &) const;
/// ///
@ -30,8 +30,6 @@ public:
void mathmlize(MathMLStream &) const; void mathmlize(MathMLStream &) const;
/// ///
void octavize(OctaveStream &) const; void octavize(OctaveStream &) const;
///
void write(WriteStream & os) const;
private: private:
/// ///

View File

@ -1,48 +0,0 @@
#include <config.h>
#include "math_funcliminset.h"
#include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "math_support.h"
MathFuncLimInset::MathFuncLimInset(string const & name)
: name_(name)
{}
MathInset * MathFuncLimInset::clone() const
{
return new MathFuncLimInset(*this);
}
bool MathFuncLimInset::isScriptable() const
{
return scriptable_;
}
void MathFuncLimInset::write(WriteStream & os) const
{
os << '\\' << name_ << ' ';
}
void MathFuncLimInset::normalize(NormalStream & os) const
{
os << "[funclim " << name_ << ']';
}
void MathFuncLimInset::metrics(MathMetricsInfo & mi) const
{
scriptable_ = (mi.base.style == LM_ST_DISPLAY);
mathed_string_dim(mi.base.font, name_, ascent_, descent_, width_);
}
void MathFuncLimInset::draw(MathPainterInfo & pi, int x, int y) const
{
drawStrBlack(pi, x, y, name_);
}

View File

@ -1,33 +0,0 @@
// -*- C++ -*-
#ifndef MATH_FUNCLIMINSET_H
#define MATH_FUNCLIMINSET_H
#include "math_diminset.h"
// "normal" symbols that don't take limits and don't grow in displayed
// formulae
class MathFuncLimInset : public MathDimInset {
public:
///
explicit MathFuncLimInset(string const & name);
///
MathInset * clone() const;
///
void write(WriteStream & os) const;
///
void normalize(NormalStream &) const;
///
void metrics(MathMetricsInfo & st) const;
///
void draw(MathPainterInfo &, int x, int y) const;
///
bool isScriptable() const;
private:
///
string const name_;
///
mutable bool scriptable_;
};
#endif

View File

@ -166,15 +166,6 @@ void MathInset::getPos(idx_type, pos_type, int & x, int & y) const
} }
void MathInset::normalize(NormalStream & os) const
{
os << "[unknown ";
WriteStream wi(os.os(), false, true);
write(wi);
os << "] ";
}
void MathInset::dump() const void MathInset::dump() const
{ {
lyxerr << "---------------------------------------------\n"; lyxerr << "---------------------------------------------\n";
@ -226,9 +217,15 @@ void MathInset::drawT(TextPainter &, int, int) const
void MathInset::write(WriteStream &) const void MathInset::write(WriteStream & os) const
{ {
lyxerr << "MathInset::write() called directly!\n"; os << '\\' << name().c_str() << ' ';
}
void MathInset::normalize(NormalStream & os) const
{
os << '[' << name().c_str() << "] ";
} }

View File

@ -3,7 +3,6 @@
#endif #endif
#include "math_lefteqninset.h" #include "math_lefteqninset.h"
#include "math_mathmlstream.h"
#include "math_support.h" #include "math_support.h"
@ -34,13 +33,7 @@ void MathLefteqnInset::draw(MathPainterInfo & pain, int x, int y) const
} }
void MathLefteqnInset::write(WriteStream & os) const string MathLefteqnInset::name() const
{ {
os << "\\lefteqn{" << cell(0) << '}'; return "lefteqn";
}
void MathLefteqnInset::normalize(NormalStream & os) const
{
os << "[lefteqn " << cell(0) << ']';
} }

View File

@ -17,12 +17,10 @@ public:
/// ///
MathInset * clone() const; MathInset * clone() const;
/// ///
void draw(MathPainterInfo &, int x, int y) const; string name() const;
/// ///
void write(WriteStream & os) const; void metrics(MathMetricsInfo & mi) const;
/// ///
void normalize(NormalStream &) const; void draw(MathPainterInfo & pi, int x, int y) const;
///
void metrics(MathMetricsInfo & st) const;
}; };
#endif #endif

View File

@ -844,8 +844,6 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
else if (t.cs() == "sqrt") { else if (t.cs() == "sqrt") {
MathArray ar; MathArray ar;
parse(ar, FLAG_OPTION, mathmode); parse(ar, FLAG_OPTION, mathmode);
lyxerr << "read option: " << ar << endl;
dump();
if (ar.size()) { if (ar.size()) {
cell->push_back(MathAtom(new MathRootInset)); cell->push_back(MathAtom(new MathRootInset));
cell->back()->cell(0) = ar; cell->back()->cell(0) = ar;

View File

@ -40,12 +40,6 @@ bool MathUnknownInset::match(MathInset * p) const
} }
void MathUnknownInset::write(WriteStream & os) const
{
os << "\\" << name_ << ' ';
}
void MathUnknownInset::normalize(NormalStream & os) const void MathUnknownInset::normalize(NormalStream & os) const
{ {
os << "[unknown " << name_ << ']'; os << "[unknown " << name_ << ']';

View File

@ -44,8 +44,6 @@ public:
/// ///
void octavize(OctaveStream &) const; void octavize(OctaveStream &) const;
/// ///
void write(WriteStream &) const;
///
void finalize(); void finalize();
/// ///
bool final() const; bool final() const;