From 2f858329dfcc82ab8c492f9da969fced21654d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 7 Nov 2001 11:14:59 +0000 Subject: [PATCH] fix 'double =' glitch git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2972 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/formula.C | 16 +--------------- src/mathed/math_cursor.C | 15 +++++++++++++++ src/mathed/math_cursor.h | 2 ++ src/mathed/math_funcinset.C | 10 ++++++++-- src/mathed/math_funcinset.h | 3 ++- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 3eb2424bc2..fcd4fec992 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -51,19 +51,6 @@ using std::vector; namespace { - void stripFromLastEqualSign(MathArray & ar) - { - // find position of last '=' in the array - MathArray::size_type pos = ar.size(); - for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it) - if ((*it)->getChar() == '=') - pos = it - ar.begin(); - - // delete everything behind this position - ar.erase(pos, ar.size()); - } - - string captureOutput(string const & cmd, string const & data) { string outfile = lyx::tempName(string(), "mathextern"); @@ -438,9 +425,8 @@ void InsetFormula::handleExtern(const string & arg) mathcursor->selGet(ar); lyxerr << "use selection: " << ar << "\n"; } else { - mathcursor->end(); + mathcursor->stripFromLastEqualSign(); ar = mathcursor->cursor().cell(); - stripFromLastEqualSign(ar); mathcursor->insert(MathAtom(new MathCharInset('=', LM_TC_VAR))); //lyxerr << "use whole cell: " << ar << "\n"; } diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index ac755a8543..beeb60793e 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -1499,3 +1499,18 @@ MathCursorPos MathCursor::normalAnchor() const } +void MathCursor::stripFromLastEqualSign() +{ + // find position of last '=' in the array + MathArray & ar = cursor().cell(); + MathArray::const_iterator et = ar.end(); + for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it) + if ((*it)->getChar() == '=') + et = it; + + // delete everything behind this position + ar.erase(et - ar.begin(), ar.size()); + pos() = ar.size(); +} + + diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index 23ba663556..7b533306c6 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -247,6 +247,8 @@ public: void seldump(char const * str) const; /// void dump(char const * str) const; + /// + void stripFromLastEqualSign(); /// friend class Selection; diff --git a/src/mathed/math_funcinset.C b/src/mathed/math_funcinset.C index f53f513edd..383b82eed3 100644 --- a/src/mathed/math_funcinset.C +++ b/src/mathed/math_funcinset.C @@ -52,11 +52,17 @@ void MathFuncInset::writeNormal(std::ostream & os) const void MathFuncInset::metrics(MathMetricsInfo const & mi) const { mi_ = mi; - mathed_string_dim(LM_TC_TEX, mi_, name_, ascent_, descent_, width_); + mathed_string_dim(LM_TC_TEXTRM, mi_, name_, ascent_, descent_, width_); } void MathFuncInset::draw(Painter & pain, int x, int y) const { - drawStr(pain, LM_TC_TEX, mi_, x, y, name_); + drawStr(pain, LM_TC_TEXTRM, mi_, x, y, name_); +} + + +string MathFuncInset::octavize() const +{ + return name_; } diff --git a/src/mathed/math_funcinset.h b/src/mathed/math_funcinset.h index 4ec3b0c32a..6faca169d4 100644 --- a/src/mathed/math_funcinset.h +++ b/src/mathed/math_funcinset.h @@ -4,7 +4,6 @@ #include "math_diminset.h" #include "math_defs.h" -#include "LString.h" #ifdef __GNUG__ #pragma interface @@ -31,6 +30,8 @@ public: string const & name() const; /// void setName(string const & n); + /// + string octavize() const; private: /// string name_;