From 9b4bf4c29d7e0fd3154d48f47648a7489c9d10dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Mon, 5 Aug 2002 07:09:11 +0000 Subject: [PATCH] fix 'vanishing \sin' bug git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4857 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_cursor.C | 4 +-- src/mathed/math_dotsinset.C | 10 ++----- src/mathed/math_dotsinset.h | 8 +++--- src/mathed/math_exfuncinset.C | 10 ++----- src/mathed/math_exfuncinset.h | 10 +++---- src/mathed/math_funcliminset.C | 48 ---------------------------------- src/mathed/math_funcliminset.h | 33 ----------------------- src/mathed/math_inset.C | 19 ++++++-------- src/mathed/math_lefteqninset.C | 11 ++------ src/mathed/math_lefteqninset.h | 8 +++--- src/mathed/math_parser.C | 2 -- src/mathed/math_unknowninset.C | 6 ----- src/mathed/math_unknowninset.h | 2 -- 13 files changed, 26 insertions(+), 145 deletions(-) delete mode 100644 src/mathed/math_funcliminset.C delete mode 100644 src/mathed/math_funcliminset.h diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 1a04e50921..7d627af268 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -1332,7 +1332,7 @@ bool MathCursor::interpret(char c) // handle macroMode if (inMacroMode()) { string name = macroName(); - //lyxerr << "interpret name: '" << name << "'\n"; + lyxerr << "interpret name: '" << name << "'\n"; if (name.empty() && c == '\\') { backspace(); @@ -1341,7 +1341,7 @@ bool MathCursor::interpret(char c) } if (isalpha(c)) { - inMacroMode()->name() += c; + inMacroMode()->setName(inMacroMode()->name() + c); return true; } diff --git a/src/mathed/math_dotsinset.C b/src/mathed/math_dotsinset.C index 83363d8bb0..c939ac9892 100644 --- a/src/mathed/math_dotsinset.C +++ b/src/mathed/math_dotsinset.C @@ -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 << ' '; -} - - -void MathDotsInset::normalize(NormalStream & os) const -{ - os << "[" << key_->name << "] "; + return key_->name; } diff --git a/src/mathed/math_dotsinset.h b/src/mathed/math_dotsinset.h index d0187a0804..fd089afd70 100644 --- a/src/mathed/math_dotsinset.h +++ b/src/mathed/math_dotsinset.h @@ -18,13 +18,11 @@ public: /// 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; - /// - void metrics(MathMetricsInfo & st) const; + string name() const; protected: /// cache for the thing's heigth mutable int dh_; diff --git a/src/mathed/math_exfuncinset.C b/src/mathed/math_exfuncinset.C index b0e98f650c..4941d3fc7a 100644 --- a/src/mathed/math_exfuncinset.C +++ b/src/mathed/math_exfuncinset.C @@ -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) << ')'; } - - -void MathExFuncInset::write(WriteStream & os) const -{ - os << '\\' << name_ << '{' << cell(0) << '}'; -} diff --git a/src/mathed/math_exfuncinset.h b/src/mathed/math_exfuncinset.h index 45692fe81c..fe240065b8 100644 --- a/src/mathed/math_exfuncinset.h +++ b/src/mathed/math_exfuncinset.h @@ -16,12 +16,12 @@ public: /// 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; /// @@ -30,8 +30,6 @@ public: void mathmlize(MathMLStream &) const; /// void octavize(OctaveStream &) const; - /// - void write(WriteStream & os) const; private: /// diff --git a/src/mathed/math_funcliminset.C b/src/mathed/math_funcliminset.C deleted file mode 100644 index c2826c6b56..0000000000 --- a/src/mathed/math_funcliminset.C +++ /dev/null @@ -1,48 +0,0 @@ -#include - -#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_); -} diff --git a/src/mathed/math_funcliminset.h b/src/mathed/math_funcliminset.h deleted file mode 100644 index 61d2e1fe50..0000000000 --- a/src/mathed/math_funcliminset.h +++ /dev/null @@ -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 diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index 70010e6234..52bbd38fc5 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -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 { 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() << "] "; } diff --git a/src/mathed/math_lefteqninset.C b/src/mathed/math_lefteqninset.C index 9362eba65e..cec496f1af 100644 --- a/src/mathed/math_lefteqninset.C +++ b/src/mathed/math_lefteqninset.C @@ -3,7 +3,6 @@ #endif #include "math_lefteqninset.h" -#include "math_mathmlstream.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) << '}'; -} - - -void MathLefteqnInset::normalize(NormalStream & os) const -{ - os << "[lefteqn " << cell(0) << ']'; + return "lefteqn"; } diff --git a/src/mathed/math_lefteqninset.h b/src/mathed/math_lefteqninset.h index 0956310561..2c480481a2 100644 --- a/src/mathed/math_lefteqninset.h +++ b/src/mathed/math_lefteqninset.h @@ -17,12 +17,10 @@ public: /// 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 metrics(MathMetricsInfo & st) const; + void draw(MathPainterInfo & pi, int x, int y) const; }; #endif diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 18d8064444..20038c420c 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -844,8 +844,6 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, else if (t.cs() == "sqrt") { MathArray ar; parse(ar, FLAG_OPTION, mathmode); - lyxerr << "read option: " << ar << endl; - dump(); if (ar.size()) { cell->push_back(MathAtom(new MathRootInset)); cell->back()->cell(0) = ar; diff --git a/src/mathed/math_unknowninset.C b/src/mathed/math_unknowninset.C index 31bb97bcbf..fac5abeb22 100644 --- a/src/mathed/math_unknowninset.C +++ b/src/mathed/math_unknowninset.C @@ -40,12 +40,6 @@ bool MathUnknownInset::match(MathInset * p) const } -void MathUnknownInset::write(WriteStream & os) const -{ - os << "\\" << name_ << ' '; -} - - void MathUnknownInset::normalize(NormalStream & os) const { os << "[unknown " << name_ << ']'; diff --git a/src/mathed/math_unknowninset.h b/src/mathed/math_unknowninset.h index 24e0382dbb..8ecc8064a6 100644 --- a/src/mathed/math_unknowninset.h +++ b/src/mathed/math_unknowninset.h @@ -44,8 +44,6 @@ public: /// void octavize(OctaveStream &) const; /// - void write(WriteStream &) const; - /// void finalize(); /// bool final() const;